php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31030 iconv() fails to output an error even if it cannot convert a string
Submitted: 2004-12-09 02:01 UTC Modified: 2004-12-12 23:45 UTC
From: rq at akl dot lt Assigned:
Status: Not a bug Package: ICONV related
PHP Version: 4.3.9 OS: Linux
Private report: No CVE-ID: None
 [2004-12-09 02:01 UTC] 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-12 23:45 UTC] moriyoshi@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC