iconv with //IGNORE cuts the string
| Bug #48147 | iconv with //IGNORE cuts the string | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2009-05-04 14:52 UTC | Modified: | 2015-05-08 07:23 UTC |
|
||||||||||
| From: | kulakov74 at yandex dot ru | Assigned: | stas (profile) | |||||||||||
| Status: | Closed | Package: | ICONV related | |||||||||||
| PHP Version: | 5.*, 6CVS (2009-05-05) | OS: | Linux | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2009-05-04 14:52 UTC] kulakov74 at yandex dot ru
Description: ------------ iconv() without //IGNORE as known cuts the string at the first illegal character, but with //IGNORE it should not. Still, I get a truncated text, but not at the point where the character is. Sorry the actual PHP version is 5.2.6, but I cannot upgrade it. Just to let you know. Can you test that with the last version? Please download the file from http://www.oppcharts.com/iconv.html Reproduce code: --------------- $Body1=... //read the file echo(strlen($Body1)."\n"); $Body2=iconv('UTF-8', 'ISO-8859-1', $Body1); echo(strlen($Body2)."\n"); $Body2=iconv('UTF-8', 'ISO-8859-1//IGNORE', $Body1); echo(strlen($Body2)."\n"); Expected result: ---------------- 15323 Notice: iconv(): Detected an illegal character in input string in /home/doldon/html/tdnam/dev.php on line 18 3588 ----------------------------------- 15323 15321 - I can get this if I use //TRANSLIT or when I run the test on my home Windows PHP 4 Actual result: -------------- 15323 Notice: iconv(): Detected an illegal character in input string in /home/doldon/html/tdnam/dev.php on line 18 3588 ----------------------------------- 15323 Notice: iconv(): Detected an illegal character in input string in /home/doldon/html/tdnam/dev.php on line 18 8157 - THIS IS THE PROBLEM
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2009-05-06 05:13 UTC] kulakov74 at yandex dot ru
Here goes the script. I'm not sure about the limit on external resources - I have the file to convert, so it is downloaded. <?php error_reporting(E_ALL); $Body1=file_get_contents("http://www.oppcharts.com/iconv.html"); echo(strlen($Body1)."\n"); $Body2=iconv('UTF-8', 'ISO-8859-1', $Body1); echo(strlen($Body2)."\n"); $Body2=iconv('UTF-8', 'ISO-8859-1//IGNORE', $Body1); echo(strlen($Body2)."\n"); ?>[2009-05-06 14:38 UTC] jani@php.net
[2009-05-06 18:18 UTC] kulakov74 at yandex dot ru
[2009-05-06 18:36 UTC] jani@php.net
[2009-05-07 07:50 UTC] lbarnaud@php.net
[2009-05-07 13:58 UTC] jani@php.net
[2011-12-18 19:37 UTC] ezyang@php.net
[2011-12-23 00:49 UTC] ezyang@php.net
-Status: Bogus +Status: Re-Opened
[2011-12-23 00:49 UTC] ezyang@php.net
[2012-01-08 12:33 UTC] pajoye@php.net
-Status: Re-Opened +Status: Feedback
[2012-01-08 12:33 UTC] pajoye@php.net
[2012-10-27 09:26 UTC] ezyang@php.net
[2013-02-18 00:33 UTC] php-bugs at lists dot php dot net
[2015-05-08 07:22 UTC] stas@php.net
-Assigned To: +Assigned To: stas
[2015-05-08 07:23 UTC] stas@php.net
-Status: No Feedback +Status: Assigned
[2015-05-10 02:29 UTC] stas@php.net
-Status: Assigned +Status: Closed
[2015-06-05 10:36 UTC] php at s-hamel dot de