Fix EZP-21038: Treemenu breaks with non latin char
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.