# Development
# Japan Specific | JIS
# UTF8 to Shift_JIS in Javascript
### Background
The ***TextEncoder()*** in js does [not support Shift\_JIS](https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/TextEncoder), 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](http://freaka.freehostia.com/charset_js.html)\[1\] or this [site](https://toracatman.github.io/UTF-JIS/)\[2\].
### Know more about Japanese Character Set
See this [presentation](http://www.mysql.gr.jp/frame/modules/bwiki/index.php?plugin=attach&refer=matsunobu&openfile=MySQLUC2007-JapaneseCharset.pdf) 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`.
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
---|
FF60 |
| 。 | 「 | 」 | 、 | ・ | ヲ | ァ | ィ | ゥ | ェ | ォ | ャ | ュ | ョ | ッ |
---|
FF70 | ー | ア | イ | ウ | エ | オ | カ | キ | ク | ケ | コ | サ | シ | ス | セ | ソ |
---|
FF80 | タ | チ | ツ | テ | ト | ナ | ニ | ヌ | ネ | ノ | ハ | ヒ | フ | ヘ | ホ | マ |
---|
FF90 | ミ | ム | メ | モ | ヤ | ユ | ヨ | ラ | リ | ル | レ | ロ | ワ | ン | ゙ | ゚ | | | |
---|
Read this [article to learn more](https://mailmate.jp/blog/half-width-full-width-hankaku-zenkaku-explained).
### Existing library
- [encoding.js](https://github.com/polygonplanet/encoding.js)
### If you cannot use external library for any reason
- Implement yourself - use mapping, you can take reference to this [script](https://github.com/toracatman/toracatman.github.io/tree/main/UTF-JIS) \[2\]
- [JIS X 0213 Table](https://toracatman.github.io/UTF-JIS/jis_x_0213.html)
### References
\[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]