Bug #70114 [NEW]: mb_convert_encoding UTF-16 and UTF-16LE BOM behaviour
| From: | cph at osde dot uk | Date: | Wed, 22 Jul 2015 13:27:46 +0000 |
| Subject: | Bug #70114 [NEW]: mb_convert_encoding UTF-16 and UTF-16LE BOM behaviour | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-194628@lists.php.net to get a copy of this message | ||
From: cph at osde dot uk
Operating system: ubuntu
PHP version: 5.6.11
Package: mbstring related
Bug Type: Bug
Bug description:mb_convert_encoding UTF-16 and UTF-16LE BOM behaviour
Description:
------------
mb_convert_encoding UTF-16 and UTF-16LE BOM behaviour may be related to
bug.php?id=34776
Test script:
---------------
$utf16 = fgets($fh, 1024);
echo bin2hex($utf16).PHP_EOL;
$utf8 =
iconv('UTF-16LE','UTF-8',mb_substr($utf16,1,null,'UTF-16LE'));
echo bin2hex($utf8).PHP_EOL;
var_export($utf8);
$utf8 = mb_convert_encoding($utf16,'UTF-8','UTF-16');
echo bin2hex($utf8).PHP_EOL;
var_export($utf8);
$utf8 = mb_convert_encoding($utf16,'UTF-8','UTF-16LE');
echo bin2hex($utf8).PHP_EOL;
var_export($utf8);
Expected result:
----------------
RAW
fffe48006f00740065006c00...
IC
486f74656c49447c22486f74...
'Hot
16
486f74656c49447c22486f74...
'Hot
16LE
486f74656c49447c22486f74...
'Hot
Actual result:
--------------
RAW
fffe48006f00740065006c00...
IC
486f74656c49447c22486f74...
'Hot
16
486f74656c49447c22486f74...
'Hot
16LE
efbbbf486f74656c49447c22...
'Hot
--
Edit bug report at https://bugs.php.net/bug.php?id=70114&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70114&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70114&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70114&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70114&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70114&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70114&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70114&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70114&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70114&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70114&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70114&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70114&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70114&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70114&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70114&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70114&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70114&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70114&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70114&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70114&r=mysqlcfg