CSV / mojibake diagnosis guide

Diagnose CSV mojibake and hand off a verified file

When text is unreadable, first separate encoding, BOM, and delimiter issues. A readable display is different from a later number or date conversion. Keep the original, export as UTF-8, then reopen the saved file and verify it.

Separate the first three causes

SymptomFirst checkNext action
Text like あいうEncoding used to read bytesCompare UTF-8 with CP932/Shift_JIS
Columns shiftDelimiter, quote, and newline rulesCheck comma, tab, or semicolon
Readable text but 001 becomes 1Later type conversionRe-import the ID as text

A UTF-8 BOM can help some readers identify encoding, but it is not a universal guarantee.

Reproduce the boundary with fixtures

utf8.csv is a UTF-8 positive case. diagnostic.csv shows mojibake, delimiter and type-conversion clues. Expected values are 2 rows, 3 columns, amount total 2180, and string IDs.

id,name,amount
001,山田太郎,1200
002,佐藤花子,980

If the original uses another encoding, record what you used to open it before exporting to UTF-8. Do not guess from a damaged display.

A safe handoff with Web-Tool

  1. Keep the original CSV and make a working copy.
  2. Open Table to Excel, then inspect encoding, delimiter and column types.
  3. Export as UTF-8 and reopen the saved file with an independent reader.
  4. Give the recipient the encoding, BOM, delimiter and verification result.

This guide and Table to Excel work in the browser. Source files and input are not sent to a URL, analytics, or an external server.

Cases that cannot be restored

If the wrong encoding already caused bytes to be lost, do not reconstruct the text by guesswork. Retrieve the original. Fixing encoding also does not fix leading-zero or long-ID type conversion; check that separately.