note 15326 added to function.iconv

From: Date: Wed, 05 Sep 2001 16:00:07 +0000
Subject: note 15326 added to function.iconv
Groups: php.notes 
Request: Send a blank email to php-notes+get-17653@lists.php.net to get a copy of this message
Function libiconv() return false to often, imho. In script below $src and $dst may be different, UTF-8 and KOI8-R, for example. In utf8 input stream may present some combination - xD0xD3 , and it's correct for utf. But if libiconv() see xD3 in input, it fail. <? error_reporting(63); $src = 'ISO-8859-1'; $dst = 'ISO-8859-2'; $j = 0; for($i=1;$i<=255;$i++) { $tst = sprintf('before%cafter',$i); $rc=libiconv($src,$dst,$tst); if (strlen($rc) == 0) { print "$i fail<br>"; $j++; } } print "total failed: $j"; ?> http://www.php.net/manual/en/function.iconv.php

« previous php.notes (#17653) next »