Bug #79122 [NEW]: mb_convert_encoding doesn't convert properly to UTF-16
| From: | pascu dot vlad at gmail dot com | Date: | Wed, 15 Jan 2020 17:28:46 +0000 |
| Subject: | Bug #79122 [NEW]: mb_convert_encoding doesn't convert properly to UTF-16 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-224916@lists.php.net to get a copy of this message | ||
From: pascu dot vlad at gmail dot com
Operating system: Irrelevant
PHP version: Irrelevant
Package: Unicode Engine related
Bug Type: Bug
Bug description:mb_convert_encoding doesn't convert properly to UTF-16
Description:
------------
mb_convert_encoding seems to not produce correct results when dealing
with higher Unicode characters. When supplying UTF-8 encoded strings,,
the mb_* functions return all valid results for characters count, code
point and byte count. However, after converting to UTF-16, the whole
string is mangled.
I have attached 4 links with relevant examples.
Test script:
---------------
https://3v4l.org/LQott
https://3v4l.org/DrEcL
https://3v4l.org/acOTR
https://3v4l.org/5VXFC
Expected result:
----------------
Correct result for total length (number of characters) and each
character (code point + byte count) in both encodings, as documented
here (links in order with code examples):
https://www.iemoji.com/view/emoji/885/smileys-people/grinning-face
https://www.iemoji.com/view/emoji/1659/flags/romania
https://www.iemoji.com/view/emoji/1379/skin-tones/baby-light-skin-tone
https://www.iemoji.com/view/emoji/306/symbols/hash-key
Actual result:
--------------
Correct result only for the supplied UTF-8 string and no valid results
for any of the converted strings.
--
Edit bug report at https://bugs.php.net/bug.php?id=79122&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79122&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79122&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79122&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79122&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79122&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79122&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79122&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79122&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79122&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79122&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79122&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79122&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79122&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79122&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79122&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79122&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79122&r=mysqlcfg