Microsoft Windows code page 932, also called Windows-31J amongst other names, is the Microsoft Windowscode page for the Japanese language, which is an extended variant of the Shift JISJapanese character encoding. It contains standard 7-bit ASCII codes, and Japanese characters are indicated by the high bit of the first byte being set to 1. Some code points in this page require a second byte, so characters use either 8 or 16 bits for encoding. IBM offer the same extended double-byte codes in their code page 943, which is a combination of the single-byte Code page 897 and the double-byte Code page 941. Windows-31J is the most used non-UTF-8/Unicode Japanese encoding on the web. Actually is the much more declared encoding, but by W3C/WHATWG HTML standards, the encodings are declared the same, and while the latter name is used in the standards it's defined to decode the former. See page for statistics.
Terminology
Microsoft's Shift JIS variant is known simply as "Code page 932" on Microsoft Windows, however this is ambiguous as IBM's code page 932, while also a Shift JIS variant, lacks the NEC and NEC-selected double-byte vendor extensions which are present in Microsoft's variant and preserves the 1978 ordering of JIS X 0208. IBM's code page 943 includes the same double byte codes as Windows code page 932. Microsoft's version corresponds closely to the encoding referred to as ibm-943_P15A-2003 in International Components for Unicode. There is also a second ICU encoding named ibm-943_P130-1999, which uses different single-byte mappings which more closely match IBM's code page definitions. Windows code page 932 is registered with the IANA as Windows-31J. The "Windows-31J" label is IANA's and not recognized by Microsoft, which has historically used "shift_jis" instead. The W3C/WHATWG encoding standard used by HTML5 treats the label "shift_jis" interchangeably with "windows-31j" with the intent of being "compatible with deployed content" and matches Windows code page 932. Windows code page 932 is also called MS_Kanji, although IANA treat MS_Kanji as an alias for standard Shift JIS. Python, for example, uses the label MS-Kanji for Windows-932 and the label Shift_JIS for JIS X 0208-defined Shift JIS, without recognising the Windows-31J label. In Japanese editions of Windows, this code page is referred to as "ANSI", since it is the operating system's default 8-bit encoding, even though ANSI was not involved in its definition.
Differences from standard Shift JIS
Windows-31J is often mistaken for standard Shift JIS : while similar, the distinction is significant for computer programmers wishing to avoid mojibake.
In addition to the standard JIS X 0201:1997 and JIS X 0208:1997 characters, Windows-31J includes several JIS X 0208 extensions, namely "NEC special characters, NEC selection of IBM extensions, and IBM extensions ", in addition to setting some encoding space aside for end user definition. This also differs from IBM-932, which does not include the NEC extensions or NEC selection. Some of these representations were subsequently used for different characters by JIS X 0213 and Shift JIS-2004. For example, compare row 89 in JIS X 0213 to row 89 as used by JIS X 0208 with IBM/NEC extensions. Consequently, Shift JIS-2004 is not compatible with Windows-31J. In addition to the above, Microsoft uses different Unicode mapping for several double-byte punctuation characters compared to standard Shift JIS, such as the wave dash being mapped to U+FF5E rather than U+301C, which is followed by ibm-943_P15A-2003 but not ibm-943_P130-1999, and using different mapping for the double byte backslash.
Windows-932 includes standard 7-bit ASCII mappings for single-byte sequences with the high bit set to 0. Hence, codes 0x5C and 0x7E are mapped to Unicode as U+005C REVERSE SOLIDUS and U+007E TILDE respectively, as they are in ASCII. This is likewise done by the W3C/WHATWG encoding standard. By contrast, 0x5C is mapped to U+00A5 YEN SIGN in ISO-646-JP and consequently JIS X 0201, of which standard Shift JIS is an extension. Correspondingly, Windows-31J avoids duplicate encoding of the backslash by mapping the double byte 0x815F to U+FF3C FULLWIDTH REVERSE SOLIDUS, whereas standard Shift JIS maps it to U+005C. However, 0x5C in Windows-932 is nonetheless considered a Yensign in certain contexts. For this reason, in many Japanese fonts, U+005C is displayed as a Yen symbol, which would normally be represented as U+00A5, rather than as a backslash per Unicode's suggested rendering. U+00A5 is one-way best-fit mapped onto 0x5C in Windows-932. However, code 0x5C in Windows-932 behaves as a reverse solidus in all respects other than how it is displayed by some fonts, and Microsoft's documentation for Windows-932 displays 0x5C as a backslash. This mapping corresponds to the encoding named "ibm-943_P15A-2003" in International Components for Unicode, except for minor reordering of a few C0 control characters. IBM-943, like IBM-932, is a superset of the single-byte Code page 897, which maps 0x5C to the Yen symbol and 0x7E to the overline, this is followed by the encoding named "ibm-943_P130-1999" in ICU. Code page 897 also adds single-byte box-drawing characters replacing certain C0 control characters, however these may still be treated as control characters depending on the context, and are mapped to control characters in ICU.