[php-src] Issue #9528: mb_convert_encoding "\" (backslash) and "~" (tilde) BC breaks to Shift_JIS-2004
| From: | youkidearitai | Date: | Tue, 13 Sep 2022 03:24:24 +0000 |
| Subject: | [php-src] Issue #9528: mb_convert_encoding "\" (backslash) and "~" (tilde) BC breaks to Shift_JIS-2004 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242406@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9528
Author: youkidearitai
### Description
The following code:
```php
<?php
$backslash_and_tilde = "~\\";
$sjis2004_backslash_and_tilde = mb_convert_encoding($backslash_and_tilde, "SJIS-2004",
"UTF-8");
var_dump(
bin2hex($sjis2004_backslash_and_tilde),
$re_convert = mb_convert_encoding($sjis2004_backslash_and_tilde, "UTF-8",
"SJIS-2004"),
bin2hex($re_convert)
);
```
Resulted in this output:
```
string(8) "8160815f"
string(6) "〜\"
string(12) "e3809cefbcbc"
```
But I expected this output instead:
```
string(4) "7e5c"
string(5) "‾¥"
string(10) "e280bec2a5"
```
Similar to #8281 . This behavior is from 5.4 to 8.0 (3v4l: https://3v4l.org/42pAL ). Please keep to Backward Compatible for
PHP 8.1.
### PHP Version
PHP 8.1.x
### Operating System
_No response_