|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50153 mb_convert_encoding couldn't convert GB2312 to UTF8 well?
Submitted: 2009-11-12 02:59 UTC Modified: 2009-11-20 01:00 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: kiange at gmail dot com Assigned:
Status: No Feedback Package: mbstring related
PHP Version: 5.2.6 OS: Ubuntu 9.04
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-11-12 02:59 UTC] kiange at gmail dot com
A mail message fetched from gmail. The original message encoded in 
big5, but the result come from gmail become GB2312 in attachments' 
name. And when converting it into utf8 with mb_convert_encoding(), the 
result become unreadable. But when change GB2312 to GBK, the result 
becomes better. Although I'm not sure if it still correct in 
characters' code, but I could read it.

Hope you won't mind that I only tested it in PHP 5.2.6.

Reproduce code:
$encodedString = '=?GB2312?B?MjAwOTExMDZfQ1lDVU1JU0xhYl+5UNObX5pXwM+On9Ob5JsuZG9j?=';
$imapDecode = imap_mime_header_decode($string);
// Returning unreadable result
mb_convert_encoding($imapDecode[0]->text, 'UTF-8', 'GB2312');
// Returning correct result
mb_convert_encoding($imapDecode[0]->text, 'UTF-8', 'GBK');


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-12 08:46 UTC]
Please try using this snapshot:
For Windows:

 [2009-11-20 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Thu Dec 13 08:01:25 2018 UTC