[php-src] Issue #10651: mb_convert_encoding() returns inconsistent output before and after 0x0e 0x0f when converting ISO-2022-JP

From: Date: Tue, 21 Feb 2023 14:41:45 +0000
Subject: [php-src] Issue #10651: mb_convert_encoding() returns inconsistent output before and after 0x0e 0x0f when converting ISO-2022-JP
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243766@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10651 Author: pakutoma ### Description When mb_convert_encoding() interprets ISO-2022-JP byte sequences, the conversion result of 0x5c is different before and after interpreting 0x0e "Shift out" and 0x0f "Shift in" in JIS X 0201 mode. Since these control characters do not have the ability to switch from JIS X 0201 character set to another, I believe that the same character must be assigned to the same byte sequence before and after 0x0e 0x0f. 3v4l: https://3v4l.org/XrFGE The following code: ```php <?php $jis_x_0201 = '1b284a'; $yen = '5c'; $shiftout_shiftin = '0e0f'; $ascii = '1b2842'; $byte_seq = $jis_x_0201 . $yen . $shiftout_shiftin . $yen . $ascii; var_dump($byte_seq); var_dump(mb_convert_encoding(hex2bin($byte_seq), 'UTF-8', 'JIS')); ``` Resulted in this output: ``` string(20) "1b284a5c0e0f5c1b2842" string(3) "¥\" ``` But I expected this output instead: ``` string(20) "1b284a5c0e0f5c1b2842" string(3) "¥¥" ``` ### PHP Version PHP 8.1.16 ### Operating System _No response_

« previous php.bugs (#243766) next »