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

From Joomla! Documentation

(PHP 4 warning issue)
 
m (Changed <code> into <source> and enabled highlighting)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
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 [http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=18493 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.  
 
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 [http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=18493 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, 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:
+
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:
  
<code>$item->name = html_entity_decode($name, ENT_COMPAT, 'UTF-8');</code>
+
<source lang="php">$item->name = html_entity_decode($name, ENT_COMPAT, 'UTF-8');</source>
  
 
To fix this problem on a site running PHP 4.x, change line 209 to:  
 
To fix this problem on a site running PHP 4.x, change line 209 to:  
  
<code>$item->name = html_entity_decode($name);</code>
+
<source lang="php">$item->name = html_entity_decode($name);</source>
  
 
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 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:
  
<code>
+
<source lang="php">
 
         if((version_compare( phpversion(), '5.0' ) < 0)) {
 
         if((version_compare( phpversion(), '5.0' ) < 0)) {
 
             $item->name = html_entity_decode($name);
 
             $item->name = html_entity_decode($name);
Line 17: Line 17:
 
             $item->name = html_entity_decode($name, ENT_COMPAT, 'UTF-8');
 
             $item->name = html_entity_decode($name, ENT_COMPAT, 'UTF-8');
 
         }
 
         }
</code>
+
</source>
  
 
So the entire function will now be as follows:
 
So the entire function will now be as follows:
  
<code>
+
<source lang="php">
 
     function _makeItem($name, $link)
 
     function _makeItem($name, $link)
 
     {
 
     {
Line 32: Line 32:
 
         $item->link = $link;
 
         $item->link = $link;
 
         return $item;
 
         return $item;
     } </code>
+
     }
 +
</source>
  
 
[[Category:Version 1.5.15 FAQ]]
 
[[Category:Version 1.5.15 FAQ]]

Latest revision as of 12:27, 17 May 2010

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;
    }