Why do I get the message "Warning: cannot yet handle MBCS in html entity decode"

From Joomla! Documentation

Revision as of 12:27, 17 May 2010 by Mvangeest (talk | contribs) (Changed <code> into <source> and enabled highlighting)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This message is caused by a bug in PHP version 4 and a change made for Joomla! version 1.5.15. For version 1.5.15, we fixed tracker issue 18493 to correct a problem where UTF-8 (non-ASCII) characters did not display correctly in the breadcrumbs module. However, this bug fix used a feature that doesn't work correctly in some older versions of PHP.

To correct this problem, upgrade your server to use PHP version 5. If that is not possible, you can make a change to line 209 of the file libraries/joomla/application/pathway.php. In version 1.5.15, this line is as follows:

$item->name = html_entity_decode($name, ENT_COMPAT, 'UTF-8');

To fix this problem on a site running PHP 4.x, change line 209 to:

$item->name = html_entity_decode($name);

If you like, you can make the following code change instead of the one above. This will allow the function to correctly display UTF-8 if the site is running PHP 5.x. Replace line 209 with the following lines:

        if((version_compare( phpversion(), '5.0' ) < 0)) {
            $item->name = html_entity_decode($name);
        } else {
            $item->name = html_entity_decode($name, ENT_COMPAT, 'UTF-8');
        }

So the entire function will now be as follows:

    function _makeItem($name, $link)
    {
        $item = new stdClass();
        if((version_compare( phpversion(), '5.0' ) < 0)) {
            $item->name = html_entity_decode($name);
        } else {
            $item->name = html_entity_decode($name, ENT_COMPAT, 'UTF-8');
        }
        $item->link = $link;
        return $item;
    }