
Japan’s Character Encoding Wars: Shift_JIS, EUC-JP and UTF-8
The same Japanese character, 表, has different bytes in Shift_JIS, EUC-JP and UTF-8. In Japan’s web history, differences between operating-system environments, email transport and vendor extensions contributed to mojibake—garbled text caused by an encoding mismatch. This article explains those Japan-specific circumstances, how the encodings work, and the checks that still matter when exchanging data.
Japanese original published: 2026-05-10
JIS and encodings: the same character, different bytes
Japanese text combines kanji, hiragana, katakana, Latin letters, numbers and symbols. JIS X 0201 covers Roman and katakana character sets, while JIS X 0208 is a two-byte coded character set that includes kanji. JIS X 0208 was previously called JIS C 6226; RFC 1468 distinguishes its 1978 and 1983 editions. These standards provided shared character sets that different computing environments could use.
It helps to distinguish a repertoire of characters, the numbers assigned to them, and the bytes used to store or transmit them. JIS X 0208 itself covers 7-bit and 8-bit coding. The important point is that Shift_JIS, EUC-JP and ISO-2022-JP can use the same JIS characters while arranging bytes or switching character sets differently.
Scroll horizontally if the table does not fit.
| Encoding of 表 | Hexadecimal bytes |
|---|---|
| Shift_JIS | 95 5C |
| EUC-JP | C9 BD |
| UTF-8 | E8 A1 A8 |
These are actual encodings of the character 表. Seeing the character on screen does not tell you which encoding the original file used.
Shift_JIS: compatibility and the 0x5C problem
Shift_JIS combines single-byte and double-byte characters. Half-width katakana fit into single bytes from 0xA1 to 0xDF, but some trailing bytes of double-byte characters overlap with ASCII values. For the conventional JIS X 0208 portion, lead bytes are in 0x81–0x9F or 0xE0–0xEF, and trailing bytes are in 0x40–0x7E or 0x80–0xFC. These ranges describe the byte structure, not a guarantee that every possible pair has an assigned character. Extensions such as CP932 add further ranges or characters.
A byte inside a character is not a standalone backslash
Scroll horizontally if the table does not fit.
| Character | Shift_JIS bytes in hexadecimal |
|---|---|
| 表 | 95 5C |
| 噂 | 89 5C |
| 申 | 90 5C |
| 能 | 94 5C |
| ソ | 83 5C |
In ASCII, 0x5C represents a backslash. In these examples, however, it is part of one Japanese character. Code that escapes text or processes paths byte by byte without respecting character boundaries may mistake it for punctuation and corrupt the string. This is the so-called 0x5C problem. It does not mean that C, Perl or another language always mishandles Shift_JIS; the input-encoding settings and implementation matter.
In Japanese environments, 0x5C may also appear with a yen-sign glyph. Keep the displayed glyph, the Unicode characters U+005C and U+00A5, and the actual byte value separate when investigating a problem.
EUC-JP: separating ASCII from multibyte sequences
EUC-JP has been used in Japanese Unix environments. ASCII uses one byte, and JIS X 0208 characters use two bytes in the range 0xA1–0xFE. Half-width katakana use a two-byte sequence beginning with 0x8E; JIS X 0212 characters use a three-byte sequence beginning with 0x8F.
The high bit distinguishes these multibyte bytes from ASCII, but it does not by itself determine the sequence length. You must interpret the prefix and subsequent bytes. Valid multibyte sequences do not contain 0x5C, so the particular Shift_JIS collision described above does not occur. That is not a general guarantee of safe text processing: character boundaries and invalid input still need attention.
If a receiving application expects a different encoding from the source file, you must select the correct source encoding when importing it or convert the file to the expected encoding. But an operating system's name does not determine a file's encoding. Windows Unicode APIs and modern Linux environments are reminders that an application's internal string representation and the encoding of its input or output files must be checked separately.
ISO-2022-JP: carrying Japanese through 7-bit email
ISO-2022-JP switches character sets with escape sequences so that Japanese text can travel through 7-bit email paths. RFC 1468, published in 1993, describes an encoding already used on Japanese networks. The document records its earlier use in JUNET.
ESC $ B (1B 24 42) selects the 1983 edition of JIS X 0208; ESC ( B (1B 28 42) returns to ASCII. The actual bytes for “Hello世界” are shown below. Spaces separate hexadecimal bytes for readability; they are not part of the encoded data.
48 65 6C 6C 6F 1B 24 42 40 24 33 26 1B 28 42
The sequence contains ASCII Hello, a switch, four bytes for 世界, and a return to ASCII. Because decoding depends on state, a slice taken from the middle may not decode correctly on its own.
Non-ASCII text in headers such as the subject line can use the separate encoded-word mechanism in RFC 2047. Its B encoding uses Base64, while Q is similar to Quoted-Printable. These must be distinguished from the body's character encoding. ISO-2022-JP has a history in Japanese email, but services did not all switch to UTF-8 in the same year.
Platform-dependent characters: Shift_JIS and CP932
Two implementations described as “Shift_JIS-based” may disagree about extension characters or their Unicode mappings. CP932 (Windows-31J) includes characters beyond the basic JIS X 0208 repertoire. Extensions also occur below 0xF040, as the following CP932 mappings show.
Scroll horizontally if the table does not fit.
| CP932 bytes | Character | Unicode |
|---|---|---|
| 87 40 | ① | U+2460 |
| 87 41 | ② | U+2461 |
| 87 54 | Ⅰ | U+2160 |
| 87 5F | ㍉ | U+3349 |
| 87 90 | ≒ | U+2252 |
Table source: Unicode Consortium: cp932 to Unicode table. This is a CP932 table, not evidence that every Mac implementation produces the same results.
The WHATWG Encoding Standard maps labels including shift_jis and windows-31j to its web-compatible Shift_JIS decoder. This compatibility rule does not guarantee that every library's “Shift_JIS” codec behaves exactly like CP932. Check the implementation and mapping table used for a conversion.
From Japanese mobile-phone emoji to Unicode
Emoji developed on Japanese mobile phones also encountered compatibility problems. MoMA holds Shigetaka Kurita's emoji for NTT DOCOMO as a work dated 1998–1999. This is one documented example of Japanese mobile-phone emoji from that period.
Differences in carriers' characters and mappings made it harder to convey the same meaning to a recipient. Unicode 6.0, released in 2010, added many emoji with Japanese mobile-phone compatibility in mind. Shared character numbers were a major step forward, but they did not make every vendor's artwork identical.
Today's emoji include single code points as well as sequences involving skin tones, flags or a zero width joiner (ZWJ). An “emoji count” depends on both the version and what is counted. The Emoji Counts reference at the end is updated over time; it should not be treated as a fixed historical count.
Why automatic detection cannot always be right
Automatic character-encoding detection is an inference. Detection methods differ, but when the same bytes are valid in multiple encodings, the bytes alone cannot always reveal the sender's intention. You can demonstrate this using only Python 3's standard library.
raw = bytes.fromhex("A4 A2")
print(raw.decode("euc_jp")) # あ
print(raw.decode("shift_jis")) # 、「
Neither operation raises an error, yet they produce different text. Successful decoding is not proof that you chose the correct encoding. Short inputs provide few clues, and ASCII-only data is shared by many more ASCII-compatible encodings.
Before relying on detection, check the sender's specification, the HTTP charset declaration and the file export settings. Declarations can be wrong too, so verify a sample containing known characters. Silently replacing decoding errors with replacement characters can destroy information.
What UTF-8 changes—and what it does not
UTF-8 represents Unicode scalar values—Unicode code points other than surrogate code points—in one to four bytes. RFC 3629 defined its current range in 2003, and the WHATWG Encoding Standard requires UTF-8 for new protocols and formats. W3Techs also reports widespread use in its website survey. That survey measures websites within its scope, not the share of all files or business systems worldwide.
- ASCII compatibility: ASCII characters keep their single-byte values, and ASCII byte values do not appear inside multibyte sequences.
- Multilingual storage: Japanese, other languages and emoji can share one encoding. Suitable fonts and rendering support are still needed.
- Consistent input and output: using UTF-8 for files and communication reduces conversions between legacy encodings.
Unicode and UTF-8 are not synonyms. If a runtime uses UTF-16 or another internal string representation, conversion at input and output boundaries remains. Character counting, normalization, incorrect charset declarations and damaged input are not solved by UTF-8 alone.
Checks at the boundary with legacy data
UTF-8 is the default choice for new web content, but an exchange partner may still require CP932 or another encoding. PowerShell 7 defaults to UTF-8 without a BOM for text output; Windows PowerShell 5.1 defaults vary by cmdlet. Do not assume “Windows means Shift_JIS.”
- Check the input and output contract for CSV and other files. Confirm whether “Shift_JIS” includes extensions such as CP932.
- Keep the original file before converting it. Do not overwrite it based solely on automatic detection.
- Test representative data containing characters such as ①, ㍉ and emoji. Do not silently replace unrepresentable characters with question marks.
- A UTF-8 BOM is optional. Follow the receiving system's import procedure and specification, and check that it does not accidentally treat the BOM as part of a column name.
A correct conversion decodes the source bytes using the source encoding, then encodes the resulting text using the destination encoding. Merely changing the encoding cannot recover characters already lost through replacement.
Key points
Japan's web-encoding difficulties combined differences in character repertoires, byte layouts and compatibility with existing systems. Shift_JIS, EUC-JP and ISO-2022-JP are not different names for one encoding.
- The 0x5C problem can arise when a byte inside a Shift_JIS character is treated as ASCII punctuation.
- EUC-JP has one-, two- and three-byte forms; ISO-2022-JP switches state with escape sequences.
- Distinguish extensions such as CP932 and the web's label mappings from the behavior of general-purpose conversion libraries.
- Use UTF-8 for new web content, while checking encoding detection, internal string representations and conversion of legacy data separately.
References and sources
- 日本規格協会: JIS X 0208:1997 7ビット及び8ビットの2バイト情報交換用符号化漢字集合 ↗(Catalog record and specification overview; the full standard is not reproduced on this page.)
- WHATWG: Encoding Standard ↗
- RFC Editor: RFC 1468: Japanese Character Encoding for Internet Messages ↗
- Unicode Consortium: Emoji ↗
- unicode.org: Emoji Counts, v18.0 ↗
- learn.microsoft.com: about_Character_Encoding - PowerShell | Microsoft Learn ↗
- w3techs.com: Usage Statistics and Market Share of UTF-8 for Websites, November 2026 ↗
- Wikipedia: Shift_JIS - Wikipedia ↗
- RFC Editor: RFC 2047: MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text ↗
- Unicode Consortium: cp932 to Unicode table ↗
- Unicode Consortium: Unicode 6.0.0 ↗
- RFC Editor: RFC 3629: UTF-8, a transformation format of ISO 10646 ↗
- MoMA: Shigetaka Kurita. Emoji. 1998-1999 ↗
Editorial note
This article was prepared with AI assistance and reviewed by an editor before publication. It may still contain factual errors, interpretation mistakes, or outdated information. Check the cited primary sources or official documentation before making an important decision.

