UTF8 to Shift_JIS in Javascript


The TextEncoder() in js does not support Shift_JIS, which means you may need to find some alternative ways to turn UTF-8 Japanese/Kana character into Shift_JIS encoding format for further handling in your use-case (such as FeliCa chip personalisation).

 To verify whether a pair of hex values is in SJIS format - use this site. [1] 

Know more about Japanese Character Set

See this presentation by MySQL.

Half-width Katakana in UTF-8

In Unicode, half-width katakana, which is called as hankaku (半角), is represented from position U+FF61 to U+FF9F.
FF70 ソ

Existing library

If you cannot use external library for any reason

  • Implement yourself  - use mapping, you can take reference to this script [2] 



[1] “Hex to SJIS,” freaka.freehostia.com. http://freaka.freehostia.com/charset_js.html (accessed Sep. 24, 2023).

[2] toracatman, “toracatman/UTF-JIS,” GitHub, Jan. 26, 2023. https://github.com/toracatman/UTF-JIS (accessed Sep. 24, 2023).

[3] “Character Width (Half-width, Full-width) Converter Online,” DenCode. https://dencode.com/en/string/character-width (accessed Sep. 24, 2023).

[1], [2], [3]
[1], [2], [3]