What garbled text actually is
When a CSV opens and shows character salad instead of readable text — café where you expected café, or a run of unrelated symbols where you expected Japanese — the data is not damaged. The bytes inside the file are exactly as they were; the program reading them is interpreting them as a different encoding.
The same text, saved as UTF-8 and then opened as Shift-JIS, comes out as nonsense, and vice versa. Garbled text is therefore a mismatch between the encoding used to write the file and the one used to read it, and reopening with the correct encoding restores it completely.
- MDN Web Docs — Encoding — the technical explanation of character encodings (official)
- RFC 4180 — Common Format and MIME Type for CSV Files — the assumptions behind the format
The two encodings behind Japanese CSV
| Encoding | Main uses | Characteristics |
|---|---|---|
| Shift-JIS (CP932) | Japanese Windows business software, legacy Excel formats, government filings | Two bytes per Japanese character. Cannot represent emoji or some kanji |
| UTF-8 | The web, cloud services, modern systems in general | Universal. Behaviour differs depending on whether a BOM is present |
A BOM (byte order mark) is a marker at the start of a UTF-8 file, and with one present Excel can recognise the file as UTF-8. So if the file is going to be opened in Excel, UTF-8 with BOM — Excel's "CSV UTF-8" option — is the safe choice.
That search is really asking what it means to save a CSV as UTF-8. The answer: the characters in the file are recorded in UTF-8, a universal standard. If the receiving system expects UTF-8, switching the encoding at save time is all it takes.
Identifying the cause
- Open the file in Notepad (or VS Code)Editors normally detect the encoding automatically. If the text looks correct there, the problem is on the reading side — Excel's assumption.
- If the editor shows garbage too, reopen with a different encodingIn VS Code, use Reopen with Encoding and try Shift-JIS, then UTF-8. Whichever one displays correctly is the file's real encoding.
- Check whether you have already saved over the garbled fileIf you have, skip to When it cannot be fixed. If not, carry on with the repair steps below.
- MDN — Encoding
- VS Code documentation — changing the file encoding — the official feature used for this diagnosis
Fix 1: reopen it through Excel's import dialog (recommended)
- Do not double-click the CSV — open a blank workbook in Excel instead
- Choose Data → From Text/CSV and pick the file
- Switch the encoding under File Origin in the previewUse 65001 for UTF-8 and 932 for Shift-JIS. Once the preview shows readable text, you have the right one.
- Click LoadThe data lands in the sheet already displaying correctly.
Because this approach never writes to the file, it is the safest of the three.
- Microsoft Support — import text/CSV files — the official procedure for specifying the encoding
Fix 2: convert the encoding and save a copy
Here you convert the file itself to whatever encoding the recipient needs. For a single file, Notepad is enough.
- Open the file in NotepadThis assumes it is displaying correctly in whatever encoding Notepad picks.
- Choose Save As and change the EncodingPick ANSI (which means Shift-JIS) or UTF-8, then save.
- Open it in the target system to confirmAlways run an acceptance check after converting.
If you need to convert a whole folder of files, the command line is faster.
# Convert every .csv in the folder to UTF-8 (with BOM)
Get-ChildItem *.csv | ForEach-Object {
$t = Get-Content $_.FullName -Encoding Default
$t | Set-Content $_.FullName -Encoding UTF8
}
- Microsoft Learn — PowerShell documentation — the official reference for Get-Content and Set-Content
Fix 3: specify the encoding in code
When code reads the file, stating the encoding every single time is the only real fix. For Japanese CSV files, four values cover essentially every case.
| Value | Meaning | When to use it |
|---|---|---|
cp932 | The Windows flavour of Shift-JIS | CSV exported by Japanese business software |
shift_jis | Plain Shift-JIS | Old government datasets (a few symbols differ from cp932) |
utf-8 | UTF-8 without BOM | CSV from the web or cloud services |
utf-8-sig | UTF-8 with BOM | Reading and writing files saved as Excel's "CSV UTF-8" |
import pandas as pd
# Read a CSV saved by Excel (no need to worry about the BOM)
df = pd.read_csv("data.csv", encoding="utf-8-sig")
# CSV from Japanese business software
df2 = pd.read_csv("data2.csv", encoding="cp932")
If you run into an error, see the encoding cheat sheet on the reading and writing guide.
Rules that stop it happening again
- Agree the encoding at every handoverWrite it down rather than leaving it verbal: "Shift-JIS for external submissions, UTF-8 for tool integrations".
- Put the encoding in the file nameA name like "sales_2026_utf8.csv" tells the recipient what they are dealing with.
- Standardise on "CSV UTF-8" when you export from ExcelDrop to Shift-JIS for a specific recipient only when you have actually seen it break in their environment.
- Always convert a copyNever overwrite the original file.
- Microsoft Support — CSV format — the official recommendation for saving
When it cannot be fixed (you already saved over it)
If the text is only displayed incorrectly because the wrong encoding was used to read it, reopening with the right one restores it. But once a garbled rendering is written back to disk, the original byte sequence is gone and no encoding will bring it back.
Your options:
- Re-obtain the data from its source — the system that exported it, or the person who sent it
- Look for the original in email attachments (Outlook and similar), shared-folder version history, or your downloads folder
- In a few narrow cases (a UTF-8 → Shift-JIS → UTF-8 round trip, for example) a manual repair tool can help, but do not count on it
"Getting back to the state before I overwrote it" is not an encoding technique — it is a backup problem. Build the habit of copying any important CSV the moment it arrives.
- MDN — Encoding — why this operation is irreversible
Frequently asked questions
Q.Why do CSV files end up garbled in the first place?
Because the encoding used to save the file differs from the one used to read it. Japanese text exists in both Shift-JIS and UTF-8, so which one gets assumed is always the question.
Q.What is the quickest fix if Excel shows garbage?
Reopen the file with "Data" → "From Text/CSV" and switch the encoding in the preview to 65001 (UTF-8) or 932 (Shift-JIS). Nothing on disk is modified, so it is completely safe.
Q.I already saved the garbled CSV. Can it be fixed?
Generally no. Re-obtain the original data from its source. If the text is only being displayed incorrectly and has not been saved, you can still recover it.
Q.What is the difference between UTF-8 and UTF-8 with BOM?
The BOM is a three-byte marker at the start of the file that lets Excel recognise it as UTF-8. Some programs choke on it, so be careful with recipients that require BOM-less UTF-8.
Q.How can I find out the encoding of a CSV someone sent me?
Open it in VS Code and the detected encoding appears in the status bar. In Notepad, the Encoding field on the Save As dialog shows what it currently assumes.