php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34239 Iconv doesn't return expected results
Submitted: 2005-08-24 20:18 UTC Modified: 2005-08-25 10:39 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mmingxx at yahoo dot com Assigned:
Status: Not a bug Package: ICONV related
PHP Version: 4.4.0 OS: Linux
Private report: No CVE-ID: None
 [2005-08-24 20:18 UTC] mmingxx at yahoo dot com
Description:
------------
Reference: 
string iconv ( string in_charset, string out_charset, string str )

Description:
Iconv converts fine from GB2312 to Big5 if str contains only keyboard characters (e.g. 123abc@#) and GB2312 encoded characters.  However, if str contains Big5 encoded characters, unexpected result would return.  I tried to use append //IGNORE to the end of the out_charset but it didn't work either.

Same problem exists for converting from Big5 to GB2312.

Reproduce code:
---------------
<?
echo iconv("GB2312", "Big5//IGNORE", "Big5: ?????r??; ");
echo iconv("Big5", "GB2312//IGNORE", "GB2312: ????????");
?>

Expected result:
----------------
Big5: ?????r??; GB2312: ????????

Actual result:
--------------
Big5: ????r?y; GB2312: ????????

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-24 22:56 UTC] sniper@php.net
Are you using libiconv or glibc?
Are you sure the implementation actually supports this?
(it's pretty unlikely this is any bug in PHP..)

 [2005-08-25 05:22 UTC] mmingxx at yahoo dot com
I obtained the following information from my php.ini file:

iconv support: enabled  
iconv implementation: glibc  
iconv library version: 2.3.2  

----------

From my experience, iconv converts fine between big5 and gb2312 except for the problem that I mentioned before.
 [2005-08-25 09:43 UTC] sniper@php.net
Does that work if you use the command line iconv tool?
(man iconv)

 [2005-08-25 10:29 UTC] mmingxx at yahoo dot com
It doesn't work either.
 [2005-08-25 10:39 UTC] sniper@php.net
Then it's not PHP bug but just something glibc hasn't implemented. 
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Sep 20 05:03:36 2021 UTC