# 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

<div id="bkmrk-see-this-presentatio" style="text-align: left;">See this [presentation](http://www.mysql.gr.jp/frame/modules/bwiki/index.php?plugin=attach&refer=matsunobu&openfile=MySQLUC2007-JapaneseCharset.pdf) by MySQL.</div>### Half-width Katakana in UTF-8

<div id="bkmrk-in-unicode%2C-half-wid" style="text-align: left;"><div style="text-align: left;">In Unicode, half-width katakana, which is called as hankaku (半角), is represented from position `U+FF61` to `U+FF9F`.</div><div style="text-align: left;"> </div><table><tbody><tr><th> </th><th>0</th><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th><th>A</th><th>B</th><th>C</th><th>D</th><th>E</th><th>F</th></tr><tr><th>FF60</th><td>  
</td><td>｡</td><td>｢</td><td>｣</td><td>､</td><td>･</td><td>ｦ</td><td>ｧ</td><td>ｨ</td><td>ｩ</td><td>ｪ</td><td>ｫ</td><td>ｬ</td><td>ｭ</td><td>ｮ</td><td>ｯ</td></tr><tr><th>FF70</th><td>ｰ</td><td>ｱ</td><td>ｲ</td><td>ｳ</td><td>ｴ</td><td>ｵ</td><td>ｶ</td><td>ｷ</td><td>ｸ</td><td>ｹ</td><td>ｺ</td><td>ｻ</td><td>ｼ</td><td>ｽ</td><td>ｾ</td><td>ｿ</td></tr><tr><th>FF80</th><td>ﾀ</td><td>ﾁ</td><td>ﾂ</td><td>ﾃ</td><td>ﾄ</td><td>ﾅ</td><td>ﾆ</td><td>ﾇ</td><td>ﾈ</td><td>ﾉ</td><td>ﾊ</td><td>ﾋ</td><td>ﾌ</td><td>ﾍ</td><td>ﾎ</td><td>ﾏ</td></tr><tr><th>FF90</th><td>ﾐ</td><td>ﾑ</td><td>ﾒ</td><td>ﾓ</td><td>ﾔ</td><td>ﾕ</td><td>ﾖ</td><td>ﾗ</td><td>ﾘ</td><td>ﾙ</td><td>ﾚ</td><td>ﾛ</td><td>ﾜ</td><td>ﾝ</td><td>ﾞ</td><td>ﾟ</td><td> </td><td> </td><td> </td></tr></tbody></table>

</div><div id="bkmrk-read-this-article-to" style="text-align: left;">Read this [article to learn more](https://mailmate.jp/blog/half-width-full-width-hankaku-zenkaku-explained).  
</div>### Existing library

<div id="bkmrk-encoding.js" style="text-align: left;">- [encoding.js](https://github.com/polygonplanet/encoding.js)

</div>### If you cannot use external library for any reason

<div id="bkmrk-implement-yourself%C2%A0-" style="text-align: left;"><div style="text-align: left;">- 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)

</div></div>### 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).  
  
‌

<div id="bkmrk-%5B1%5D%2C-%5B2%5D%2C-%5B3%5D" style="background: rgb(255, 255, 255); color: black; font-family: Times New Roman, serif; font-size: 12pt; opacity: 0; position: fixed;">[1], [2], [3]</div><div id="bkmrk-%5B1%5D%2C-%5B2%5D%2C-%5B3%5D-1" style="background: rgb(255, 255, 255); color: black; font-family: Times New Roman, serif; font-size: 12pt; opacity: 0; position: fixed;">[1], [2], [3]</div>