From: kiange at gmail dot com
Operating system: Ubuntu 9.04
PHP version: 5.2.11
PHP Bug Type: mbstring related
Bug description: mb_convert_encoding couldn't convert GB2312 to UTF8 well?
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');
--
Edit bug report at http://bugs.php.net/?id=50153edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50153r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50153r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50153r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50153r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50153r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50153r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50153r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50153r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50153r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50153r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50153r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50153r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50153r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50153r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50153r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=50153r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50153r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50153r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50153r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50153r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50153r=mysqlcfg