php.net |  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
Votes:2
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
Description:
------------
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:
---------------
<?php
$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');


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-12 08:46 UTC] jani@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [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-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC