note 89483 modified in function.html-entity-decode by danbrown

From: Date: Tue, 10 Mar 2009 13:37:43 +0000
Subject: note 89483 modified in function.html-entity-decode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-151685@lists.php.net to get a copy of this message
I just ran into the: Bug #27626 html_entity_decode bug - cannot yet handle MBCS in html_entity_decode()! The simple solution if you're still running PHP 4 is to wrap the html_entity_decode() function with the utf8_decode() function. <?php $string = '&nbsp;'; $utf8_encode = utf8_encode(html_entity_decode($string)); ?> By default html_entity_decode() returns the ISO-8859-1 character set, and by default utf8_decode()... http://us.php.net/manual/en/function.utf8-decode.php "Converts a string with ISO-8859-1 characters encoded with UTF-8 to single-byte ISO-8859-1" --was-- I just ran into the: Bug #27626 html_entity_decode bug - cannot yet handle MBCS in html_entity_decode()! The simple solution if you're still running PHP 4 is to wrap the html_entity_decode() function with the utf8_decode() function. <?php $string = '&nbsp;'; $utf8_string = utf8_decode(html_entity_decode($string)); ?> By default html_entity_decode() returns the ISO-8859-1 character set, and by default utf8_decode()... http://us.php.net/manual/en/function.utf8-decode.php "Converts a string with ISO-8859-1 characters encoded with UTF-8 to single-byte ISO-8859-1" http://php.net/manual/en/function.html-entity-decode.php

« previous php.notes (#151685) next »