#50153 [NEW]: mb_convert_encoding couldn't convert GB2312 to UTF8 well?

2009-11-11 Thread kiange at gmail dot com
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



#43849 [NEW]: date('YW', strtotime('2007-12-31')) return 200701

2008-01-14 Thread kiange at gmail dot com
From: kiange at gmail dot com
Operating system: Ubuntu
PHP version:  5.2.5
PHP Bug Type: Date/time related
Bug description:  date('YW', strtotime('2007-12-31')) return 200701

Description:

Enviornments:
PHP 5.2.3-1ubuntu6.2

Reproduce code:
---
echo date('YW', strtotime('2007-12-31'));
// return 200701, maybe 200801 according to the reference page
echo strftime(%Y%W,strtotime(2007-12-31));
// return 200753

Expected result:

200753 or 200801

Actual result:
--
200701

-- 
Edit bug report at http://bugs.php.net/?id=43849edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43849r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43849r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43849r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43849r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43849r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=43849r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=43849r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=43849r=needscript
Try newer version:http://bugs.php.net/fix.php?id=43849r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=43849r=support
Expected behavior:http://bugs.php.net/fix.php?id=43849r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=43849r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=43849r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43849r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43849r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43849r=dst
IIS Stability:http://bugs.php.net/fix.php?id=43849r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=43849r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43849r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=43849r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=43849r=mysqlcfg