Fix EZP-21038: Treemenu breaks with non latin char

Issue: https://jira.ez.no/browse/EZP-21038

Since b768d2f22bae527eaa659d16fba84c3e63507e5c, treemenu is broken
because htmlentities() needs to know the charset used, especially when
it is not UTF-8 (PHP 5.4) or ISO-8859-1 (PHP 5.3).
Also use mb_strlen() instead of strlen(), and specify the charset in the
Content-Type HTTP header.