[php-src] Issue #8281: mb_convert_encoding "\" (backslash) and "~" (tilde) convert failed to Shift_JIS
| From: | youkidearitai | Date: | Wed, 30 Mar 2022 14:29:50 +0000 |
| Subject: | [php-src] Issue #8281: mb_convert_encoding "\" (backslash) and "~" (tilde) convert failed to Shift_JIS | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240580@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8281
Author: youkidearitai
### Description
Backslash(\\) and tilde(~) is convert to Shift_JIS (SJIS) using mb_convrert_encoding, But converted
word is wrong word. Please see below code and 3v4l <https://3v4l.org/nSVPB>. Reproduced only PHP 8.1.
The following code:
```php
<?php
var_dump(mb_convert_encoding(mb_convert_encoding("\\", "SJIS",
"UTF-8"), "UTF-8", "SJIS"));
var_dump(mb_convert_encoding(mb_convert_encoding("~", "SJIS",
"UTF-8"), "UTF-8", "SJIS"));
```
Resulted in this output:
```
string(3) "\"
string(3) "〜"
```
But I expected this output instead:
```
string(1) "\"
string(1) "~"
```
### PHP Version
PHP 8.1.4
### Operating System
_No response_