Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added about SJIS and Unicode conversion map in PHP 8.1 #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions reference/mbstring/functions/mb-convert-encoding.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@
</row>
</thead>
<tbody>
<row>
<entry>8.1.0</entry>
<entry>
SJISの<emphasis>\</emphasis>(<literal>\x5C</literal>) と <emphasis>~</emphasis>(<literal>\x7E</literal>) が
<emphasis>¥</emphasis>(<literal>\u{00A5}</literal>) と <emphasis>‾</emphasis>(<literal>\u{203E}</literal>) に
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文字コードの表記方法は https://www.php.net/manual/language.types.string.php に従いました。前者はバイト、後者はUnicodeのコードポイントに基いているため表記が異なります。

マッピングされるようになりました。SJIS-WINとしても知られるCP932はこの変更の影響を受けません。
</entry>
</row>
<row>
<entry>8.0.0</entry>
<entry>
Expand Down Expand Up @@ -160,6 +168,9 @@ $str = mb_convert_encoding($str, "UCS-2LE", "JIS, eucjp-win, sjis-win");

/* mbstring.language が "Japanese" の場合 "auto" は、"ASCII,JIS,UTF-8,EUC-JP,SJIS" に展開される */
$str = mb_convert_encoding($str, "EUC-JP", "auto");

/* PHP 8.0以前と互換性のあるSJISからUTF-8への変換 */
$str = strtr(mb_convert_encoding($input, 'UTF-8', 'SJIS'), ['¥' => '\\', '‾' => '~']);
?>
]]>
</programlisting>
Expand Down