KomuraSoft LLC
Chapter 7

Final exercises — deducing the mojibake

Every kind of garbling leaves a fingerprint. Through 8 cases modeled on real incident investigations, deduce with the whole course's knowledge which encoding wrote the bytes and which encoding read them.

The final 8 questions — a garbled screen is evidence

The last chapter is a set of comprehensive exercises. The preceding chapters showed that garbling leaves fingerprints. Runs of 縺, 繧, 繝 mean UTF-8 misread as Shift_JIS; runs of ã mean a Latin-1 misreading; volleys of � mean Shift_JIS-family bytes misread as UTF-8; replacement with ? means data lost in conversion. A garbled screen is no longer meaningless noise — it is evidence that names the misreading pair.

In all 8 cases, return to the motto — which encoding wrote these bytes, and which encoding was used to read them?

If you get stuck on…Go back to
Bytes vs. readings; character sets vs. encodingsChapter 1
Code points and reading U+XXXXChapter 2
UTF-8 byte structure, the meaning of E3, the BOMChapter 3
Shift_JIS 2-byte structure, dame-moji, CP932Chapter 4
Surrogate pairs and how length countsChapter 5
Declaration vs. reality, Excel and BOM, DB connection settingsChapter 6
Diagram of the four classic patterns: 縺, 繧, 繝 mean UTF-8 misread as Shift_JIS; runs of ã mean a Latin-1 misreading; repeated replacement characters mean Shift_JIS misread as UTF-8; replacement with ? means data lost during conversion

The four classic patterns. Top-left and top-right are misreadings, recoverable by re-reading; bottom-right is a replacement in which the original data is gone. Telling them apart decides whether recovery is possible.

Three facts that carry the deduction (review)

  • Hiragana in UTF-8 starts with E3 81 / E3 82 / E3 83 (Chapter 3). Those 2-byte pairs are 縺, 繧, 繝 in the Shift_JIS table — so a UTF-8 → Shift_JIS misreading floods the screen with those 3 kanji. Misread the word 文字化け itself and you get 譁�ュ怜喧縺�
  • Shift_JIS second bytes intrude into the ASCII range (Chapter 4). Read as UTF-8, most bytes are invalid and become � (displayed as ? in some environments), with only the ASCII-range second bytes surviving as fragments
  • Latin-1-family tables always manage to "read" every byte, 1 byte = 1 character. Three UTF-8 bytes swell into 3 Latin characters, with ã (from E3) as the telltale

Now, let us begin.

Case 7-1 — Reading the fingerprints of garbled text

Scope: Chapters 1, 3, and 4. The garbled characters themselves are the evidence.

Q1. Case: you open a CSV from a business partner and find strings like 縺薙s縺ォ縺。縺ッ — the kanji 縺, 繧, 繝 mixed with half-width kana. What is the strongest deduction?

Q2. Case: in another file, a spot that should have read テスト has garbled to �e�X�g — replacement characters '�' with stray Latin letters between them. What is the strongest deduction?

Q3. Case: Japanese text passed through a foreign-made tool comes out as runs of accented Latin letters like ã“ã‚“ã«ã¡ã¯ — and it has swollen to roughly 3 characters per original character. What is the strongest deduction?

Case 7-2 — Triaging field incidents

Scope: Chapters 4 to 6. CSV, email, replacement — separate the layers of cause by the differences in symptoms.

Q4. Case: about a UTF-8 (no BOM) CSV produced by your system, a user reports 'when I double-click it, Excel shows the Japanese garbled like 縺薙s…'. Which cause-and-fix pairing is correct?

Q5. Case: after migrating a customer list, some customer names came out as ????. What is the decisive difference from 縺薙s…-style garbling?

Q6. Case: a received email's body is fine, but only the subject shows symbol strings like =?UTF-8?B?...?= or meaningless characters. Which is the most plausible explanation?

Case 7-3 — The deduction finale

All chapters in play. Return to the motto — which encoding wrote these bytes, and which encoding read them?

Q7. Case: feeding a file named ソフト一覧.csv through an old Shift_JIS-based interface program, only the rows containing ソ get imported with their columns shifted. What is the most likely cause?

Q8. Case: you are migrating data accumulated in EUC-JP on an old system to a new UTF-8 system. What is the correct procedure?

Closing the course — carry the two stages and the one question with you

Well done. The lookup tables this course asked you to memorize amount to just a few lines. What you should take away instead is a way of seeing that works anywhere.

  • Characters are always handled in two stages: number (code point) → bytes (encoding)
  • A file's substance is bytes alone. The declaration (label) is only a reading instruction; it converts nothing
  • When it garbles, ask — which encoding wrote these bytes, and which encoding read them? The fingerprint of the garbling tells you the direction
  • Misreadings are reversible; replacement (?) is not. Never save while garbled

The next time you meet mojibake, you are no longer someone who reopens the file with random encodings until something works. You are someone who identifies the misreading pair from the evidence and judges whether to fix the declaration or the bytes. The Chapter 3 simulator remains yours to use — when you meet a suspicious byte sequence, reproduce it at your desk.