Shift-JIS Shift-JIS (Shift Japanese Industrial Standard) Legacy & Platform-Specific
One of two major competing legacy Japanese encodings — still common in older Windows-originated Japanese text and some file formats despite UTF-8's dominance.
What it is
Shift-JIS is a variable-width encoding for Japanese text, designed to be compatible with single-byte ASCII/JIS X 0201 characters while adding 2-byte sequences for kanji, hiragana, and katakana. It was historically dominant on Windows and in many consumer Japanese software contexts, competing for decades with EUC-JP (more common in Unix contexts) — a rivalry that made Japanese text encoding notoriously confusing before UTF-8 became the practical unifying default.
Byte structure
| Byte pattern | Length | Content |
|---|---|---|
| 0x00–0x7F (with some exceptions) | 1 byte | ASCII-compatible range, with some differences (e.g., backslash vs. yen sign ambiguity at 0x5C) |
| 0xA1–0xDF | 1 byte | Half-width katakana |
| Two-byte lead + trail byte combinations | 2 bytes | Kanji, full-width hiragana/katakana, and other Japanese characters |
Why your text is garbled (symptom → cause)
| Symptom | Likely cause |
|---|---|
| Japanese text shows as scattered unrelated kanji/symbols ("mojibake" — literally "character transformation" in Japanese) | Classic Shift-JIS/EUC-JP/UTF-8 mismatch — three genuinely different, mutually incompatible encodings historically competed for the same Japanese text |
Backslash (\) displays as yen sign (¥) or vice versa |
A known Shift-JIS quirk — byte 0x5C is ASCII backslash in most contexts but was historically mapped to the yen sign in Japanese-locale rendering, causing confusion in file paths and code containing both Japanese text and backslashes |
| File correct in older Japanese software, garbled in modern tools | Legacy Shift-JIS file being read by tooling defaulting to UTF-8 without explicit conversion |
Compatibility & gotchas
- The three-way Shift-JIS/EUC-JP/UTF-8 split made Japanese text encoding one of the most notoriously confusing areas of pre-Unicode software — the term "mojibake" (文字化け, garbled characters) originated specifically from this kind of Japanese text corruption and is now used more broadly in English-language discussions of any encoding mismatch.
- The backslash/yen sign ambiguity at byte 0x5C is a specific, well-known Shift-JIS gotcha — code or file paths containing this byte can render unexpectedly depending on locale/font assumptions, occasionally causing real bugs in file-path handling on Japanese-locale Windows systems.
- Multiple Shift-JIS variants exist (Shift-JIS, Shift-JIS-2004, Windows-31J/CP932 with vendor-specific extensions) with subtle differences — "Shift-JIS" as a label doesn't always guarantee byte-for-byte identical behavior across systems.
- Still appears in some Japanese file formats and legacy software as of 2026, particularly older enterprise systems and some file formats that predate widespread UTF-8 adoption.
Fixing it
- Command-line conversion:
iconv -f SHIFT-JIS -t UTF-8 input.txt -o output.txt(orCP932for the Windows-specific variant if standard Shift-JIS doesn't decode correctly) - If unsure whether text is Shift-JIS or EUC-JP: try both and check which produces coherent Japanese text — automated encoding-detection libraries (like Python's
chardet/charset-normalizer) can also help identify Japanese-specific encodings with reasonable accuracy.
Comparison
| Encoding | Key difference from Shift-JIS |
|---|---|
| EUC-JP | The other major historically competing Japanese encoding, more common in Unix contexts, different byte layout |
| UTF-8 | Full Unicode coverage, the modern unifying default that ended the Shift-JIS/EUC-JP rivalry for new content |
FAQ
What is "mojibake"?
Mojibake (文字化け) is the Japanese term for garbled text resulting from an encoding mismatch — originally describing corrupted Japanese characters specifically, but now commonly used in English-language software discussions to describe any encoding-mismatch text corruption, regardless of language.
Why does a backslash sometimes show as a yen sign in Japanese text?
Byte 0x5C in Shift-JIS/JIS X 0201 has historically been ambiguous between ASCII backslash and the yen sign symbol, depending on locale and font rendering assumptions — a well-known quirk that occasionally causes confusion in file paths on Japanese-locale systems.
Is Shift-JIS still relevant today?
Less so for new development — UTF-8 is the standard modern choice — but it still appears in legacy Japanese software, older file formats, and some enterprise systems that predate full Unicode adoption.
Fun fact
The word "mojibake" has become enough of a standard term in international software engineering discourse that it appears in English-language technical documentation and bug reports worldwide — one of a small number of Japanese loanwords (alongside "kaizen" and a handful of others) that entered general technical vocabulary through a very specific, encoding-related origin story.