#48147 [Opn->Fbk]: iconv with //IGNORE cuts the string
| From: | jani@php.net | Date: | Tue, 05 May 2009 02:08:00 +0000 |
| Subject: | #48147 [Opn->Fbk]: iconv with //IGNORE cuts the string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-136781@lists.php.net to get a copy of this message | ||
ID: 48147
Updated by: jani@php.net
Reported By: kulakov74 at yandex dot ru
-Status: Open
+Status: Feedback
Bug Type: ICONV related
Operating System: Linux
PHP Version: 5.2.6
New Comment:
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 the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
Previous Comments:
------------------------------------------------------------------------
[2009-05-04 14:52:10] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48147&edit=1