From:             michael202 at gmx dot de
Operating system: Win XP
PHP version:      5.2.5
PHP Bug Type:     mbstring related
Bug description:  mb_convert_encoding 'destroys' first character (UTF16->UTF8)

Description:
------------
mb_convert_encoding 'destroys' first character when
converting from UTF16 to UTF8

(iconv works).

Reproduce code:
---------------
$utf16 = chr(0xFF).chr(0xFE).chr(0x4d).chr(0).chr(0x6f).chr(0); //'Mo'

$utf8 = mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');  

echo($utf8 . "\n");     // -> ´++´¢ìo

$utf8 = iconv('UTF-16', 'UTF-8', $utf16);  

echo($utf8 . "\n");     // -> Mo 


Expected result:
----------------
mb:    (BOM8)Mo
iconv: Mo

(BOM8) is a placeholder

Actual result:
--------------
mb:    (BOM8)´¢ìo  (copied from cmd shell)
iconv: Mo

(BOM8) is a placeholder



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

Reply via email to