ID: 31314 Updated by: [EMAIL PROTECTED] Reported By: yury at gorodok dot net -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Windows PHP Version: 5.0.2 New Comment:
This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. //ignore is already mentioned in the docs. I've only added: "Otherwise, str is cut from the first illegal character." Previous Comments: ------------------------------------------------------------------------ [2005-01-11 08:46:44] [EMAIL PROTECTED] Add //ignore to the target charset, like: "windows-1251//ignore" and it will just skip the character. IMO this should be put more clearly into the documentation. ------------------------------------------------------------------------ [2005-01-10 21:48:32] [EMAIL PROTECTED] iconv() stops on illegal character. That's not PHP problem, it's usual behaviour of libiconv. ------------------------------------------------------------------------ [2004-12-29 14:46:55] yury at gorodok dot net Here is the full script: (the files on which I've experienced the bug, I've pointed earlier) <?php // UTF->WIN if ( count($argv)< 2) { echo "\n2 arguments needed!\n"; exit; } $fns=$argv[1]; $fnts=$argv[2]; $f=fopen($fns, "rb"); $ff=fopen($fnts, "wb"); $flen=filesize($fns); $fstr=fread($f, $flen); echo $flen."\n"; $ffstr=iconv("UTF-8","windows-1251",$fstr); echo strlen($ffstr)."\n"; echo fwrite($ff,$ffstr/*,strlen($ffstr)*/)."\n"; fclose($ff); fclose($f); ?> ------------------------------------------------------------------------ [2004-12-28 22:07:59] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2004-12-28 16:17:20] yury at gorodok dot net Just not using third parameter in fwrite() _doesn't_help_ a bit! All lines with mbstring were (and are) commented out; I cann't see it in my phpinfo()-- so, I cann't say what value mbstring.func_overload has. Here is the code, that doesn't work now: $f=fopen($fns, "rb"); $ff=fopen($fnts, "wb"); $flen=filesize($fns); $fstr=fread($f, $flen); echo $flen."\n"; $ffstr=iconv("UTF-8","windows-1251",$fstr); echo strlen($ffstr)."\n"; echo fwrite($ff,$ffstr/*,strlen($ffstr)*/)."\n"; fclose($ff); fclose($f); Also, for some other files (that translated good), there was no problem with length. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/31314 -- Edit this bug report at http://bugs.php.net/?id=31314&edit=1