#31030 [Opn->Bgs]: iconv() fails to output an error even if it cannot convert a string
ID: 31030
Updated by: moriyoshi@php.net
Reported By: rq at akl dot lt
-Status: Open
+Status: Bogus
Bug Type: ICONV related
Operating System: Linux
PHP Version: 4.3.9
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
See the following post in php-i18n@lists.php.net:
http://news.php.net/php.i18n/766
Previous Comments:
------------------------------------------------------------------------
[2004-12-09 02:01:16] rq at akl dot lt
Description:
------------
It's a duplicate of Bug #29852, which I cannot comment because it's
marked as "Bogus", which it's not
I'm using iconv() for some charset conversions, and, before converting
anything to users' supplied charset, i use iconv() to check whether it
would convert flawlessly. And I noticed, that iconv() never returns any
error if at least the first character in the array given for conversion,
is convertable.
However, i think it's a bug somewhere in PHP, because the iconv(1)
console command outputs an error in both similar cases:
rq@sugar:~ $ echo "rûta" > r
rq@sugar:~ $ iconv -futf-8 -tascii r
riconv: illegal input sequence at position 1
^^ note the "r" here.
rq@sugar:~ $ echo "ûta" > r
rq@sugar:~ $ iconv -futf-8 -tascii r
iconv: illegal input sequence at position 0
rq@sugar:~ $ echo "ruta" > r
rq@sugar:~ $ iconv -futf-8 -tascii r
ruta
Reproduce code:
---------------
I wrote a small testcase script to demonstrate this issue. It's located
at:
http://jazz.lma.lt/~rq/iconv.php
and source is at:
http://jazz.lma.lt/~rq/iconv.phps.
For example, check out these two links:
http://jazz.lma.lt/~rq/iconv.php?text=r%C3%BBta&charset=ascii&submit=
http://jazz.lma.lt/~rq/iconv.php?text=%C3%BBta&charset=ascii&submit=
The only difference in them is an "r" letter in the beginning of the
"text" variable. And in case it exists in "text", no errors are
reported.
Expected result:
----------------
In both cases, iconv() should have reported an error.
Actual result:
--------------
iconv() did not return an error in the first case, when there was an
ASCII letter before any unconvertable strings.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31030&edit=1
Thread (2 messages)