note 47141 deleted from function.utf8-decode by betz
| From: | betz@php.net | Date: | Thu, 04 Nov 2004 16:15:53 +0000 |
| Subject: | note 47141 deleted from function.utf8-decode by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-79623@lists.php.net to get a copy of this message | ||
Note Submitter: dobersch at gmx dot net
----
Note that although the doku above says that utf8_decode() decodes data, assumed to be UTF-8 encoded
to ISO-8859-1, the output of iconv() and utf8_decode() in the example below is not equal.
This is especially a problem if you want to decode utf8-encoded data like those google-urls
containing EURO signs like the following one:
http://www.google.de/search?hl=de&q=20+%E2%82%AC&meta=
(use urldecode() on it first)
IMO it's better to use the iconv() function, which is returning the the right data for me...
hope that helps...
<?PHP
print '<pre>';
print_r(iconv_get_encoding()); // 'ISO-8859-1' for input, internal an output here
print '</pre>';
if( iconv("UTF-8","ISO-8859-1", "\xE2\x82\xAC") !=
utf8_decode("\xE2\x82\xAC") ) {
print 'not equal!';
}
else print 'equal!';
?>
----
Reason: bad code