note 15326 rejected from function.iconv by spic
| From: | spic@php.net | Date: | Wed, 28 Aug 2002 11:38:45 +0000 |
| Subject: | note 15326 rejected from function.iconv by spic | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-35900@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";
?>