Respect httpCharset in treemenu
Since rb768d2, 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.