|  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
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: mmingxx at yahoo dot com
New email:
PHP Version: OS:


 [2005-08-24 20:18 UTC] mmingxx at yahoo dot com
string iconv ( string in_charset, string out_charset, string str )

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: ????????


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-24 22:56 UTC]
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]
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]
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: Sun Oct 24 04:03:35 2021 UTC