The Online Encyclopedia and Dictionary







Shift_JIS (SJIS) is a character encoding for the Japanese language developed by a Japanese company called ASCII and adopted by, amongst others, Microsoft. It is based on character sets defined within JIS standards (for the single-byte characters) and JIS X 0208:1997 (for the double byte characters). The lead bytes for the double byte characters are "shifted" around the 64 half-width katakana characters in the single-byte range 0xA0 to 0xDF. The single-byte characters 0x00 to 0x7F match the ASCII encoding (unrelated to the ASCII company mentioned earlier!), except for a Yen sign at 0x5C and an overline at 0x7E in place of the ASCII character set's backslash and tilde respectively.

Shift_JIS requires an 8-bit medium for transmission. However, unlike competing 8-bit format EUC, Shift_JIS only guarantees that the first byte will be in the upper ASCII range; the value of the second byte can be either high or low. This makes reliable Shift_JIS detection difficult.

For a double-byte JIS sequence j1j2, the transformation to the corresponding Shift_JIS bytes s1s2 is:

33 \le j_1 \le 96 \Rightarrow s_1 = \frac{j_1 + 1}{2} + 112\,
97 \le j_1 \le 126 \Rightarrow s_1 = \frac{j_1 + 1}{2} + 176\,
j_1 \mbox{ is odd } \Rightarrow s_2 = j_2 + 31 + \operatorname{trunc}\left( \frac{j_2}{95} \right) \,
j_1 \mbox{ is even } \Rightarrow s_2 = j_2 + 126\,

Many different versions of Shift_JIS exist. There are two areas for expansion: Firstly, JIS X 0208 does not fill the whole 94x94 space encoded for it in Shift_JIS, therefore there is room for more characters here -- these are really extensions to JIS X 0208 rather than to Shift_JIS itself. The most popular extension here is to the Windows-31J (otherwise known as Code Page 932) encoding popularized by Microsoft. Secondly, Shift_JIS has more encoding space than is needed for JIS X 0201 and JIS X 0208 and these can and are used for yet more characters. The space with lead bytes 0xF5 to 0xF9 is used by Japanese mobile phone operators for pictographs for use in email, for example (KDDI goes further and defines hundreds more in the space with lead bytes 0xF3 and 0xF4).

Beyond even this there have been numerous minor variations made on Shift_JIS, with individual characters here and there altered. Most of these extensions and variants have no IANA registration, so there is much scope for confusion if the extensions are used. Microsoft Code Page 932 is registered separately from Shift_JIS.

IBM 943 has the same extensions as Code Page 932.

See also: Mojibake

External links

Last updated: 08-03-2005 14:50:49
The contents of this article are licensed from under the GNU Free Documentation License. How to see transparent copy