Garbled Characters in CSV Files (é, ’): Causes and Fixes
Updated 2 min read
If your CSV shows “Café” instead of “Café”, “It’s” instead of “It’s”, or a stray “” before spaces and symbols, the file has an encoding problem. The good news: in most cases nothing is lost, and the text can be repaired exactly.
What is a character encoding?
Computers store text as bytes, and an encoding is the rule that maps characters to bytes. Plain English letters are the same in almost every encoding, which is why only accents, curly quotes and symbols break. Today's standard is UTF-8, which can store every character in every language. Older Windows software often uses Windows-1252 (also called ANSI), which only covers Western European characters.
Why é becomes é
In UTF-8, é is stored as two bytes. A program that wrongly reads the file as Windows-1252 shows each byte as a separate character: Ã and ©. The same happens to every non-English character, which produces these familiar patterns:
| You see | It should be |
|---|---|
| é | é |
| è | è |
| ü | ü |
| ñ | ñ |
| ’ | ’ (apostrophe) |
| “ and †| “ and ” (quotes) |
| – | – (dash) |
| € | € |
| © | © |
| Â before a space | a non-breaking space |
This kind of garbling is called mojibake. Because every original byte is still there, the text can be converted back.
The opposite problem: � and question marks
If you see � or ? where letters should be, a program replaced characters it could not read, usually because a Windows-1252 file was read as UTF-8. If you still have the original file, open it again with the right encoding; CleanCSV detects Windows-1252 automatically. If the file was saved after the replacement, those characters are lost and the data must be exported again from its source.
How to fix garbled text
- In your browser: open the Fix CSV encoding tool, drop the file and download it. The file's encoding is detected automatically, Repair garbled characters turns mojibake such as é back into é, and genuine accented text is left alone.
- In Excel: you can avoid garbling at import time with Data > From Text/CSV and File origin: 65001: Unicode (UTF-8). Excel has no built-in way to repair text that is already garbled inside the cells.
- In Python: read files with
encoding="utf-8-sig", which also removes a byte order mark, orencoding="cp1252"for old Windows exports. To repair mojibake in a string,text.encode("cp1252").decode("utf-8")reverses the most common case, and the ftfy library handles the tricky ones.
Prevent it: save CSV files as UTF-8
- In Excel, use Save As with CSV UTF-8 (Comma delimited) rather than plain CSV (Comma delimited).
- In Google Sheets, File > Download > Comma-separated values always produces UTF-8.
- If the file will be opened in Excel by double-clicking, include a byte order mark (BOM). CleanCSV's Excel-friendly UTF-8 download option does this.
- If the file goes to a database or a script, plain UTF-8 without a BOM is usually the safer choice.