UTF-16 strings prefixed by BOMs wrondly converted
| Bug #49528 | UTF-16 strings prefixed by BOMs wrondly converted | ||||
|---|---|---|---|---|---|
| Submitted: | 2009-09-11 07:45 UTC | Modified: | 2009-09-23 14:27 UTC | ||
| From: | moriyoshi@php.net | Assigned: | moriyoshi (profile) | ||
| Status: | Closed | Package: | mbstring related | ||
| PHP Version: | 5.3SVN-2009-09-11 (SVN) | OS: | * | ||
| Private report: | No | CVE-ID: | None | ||
[2009-09-11 07:45 UTC] moriyoshi@php.net
Description:
------------
The first character of a UTF-16 string prefixed by "\xff\xfe" (LE BOM) gets converted to wrong Unicode codepoint. Moreover, the resulting string contains the BOM itself while it is uncalled for.
Reproduce code:
---------------
<?php
var_dump(bin2hex(mb_convert_encoding("\xff\xfe\x01\x02\x03\x04", "UCS-2", "UTF-16")));
?>
Expected result:
----------------
string(8) "02010403"
Actual result:
--------------
string(12) "feffff010403"
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2009-09-11 08:18 UTC] sjoerd@php.net
[2009-09-11 08:21 UTC] jani@php.net
[2009-09-11 14:34 UTC] jani@php.net
[2009-09-11 21:07 UTC] moriyoshi@php.net
[2009-09-23 14:27 UTC] moriyoshi@php.net