Fix CSV Encoding Issues (UTF-8 Guide)
Fix weird characters in your CSV files. Understand UTF-8 vs ANSI, fix mojibake (), and ensure your data displays correctly everywhere.
Fix CSV Encoding Issues (UTF-8 Guide)
You open a CSV file and instead of "Café", you see "Café". Or "José" becomes "Jos".
Welcome to Encoding Hell.
This happens when a file is saved in one "language" (encoding) but opened by a program expecting another. The most common conflict is between UTF-8 (the universal standard) and Windows-1252 (Excel's default).
Here is how to fix it and make your text readable again.
What is Encoding?
Computers store text as numbers (bytes). An "encoding" is the map that tells the computer which number equals which letter.
- UTF-8: The standard. Supports every character (English, Chinese, Emojis).
- Windows-1252 / ANSI: Older Windows standard. Supports English and Western European well, breaks on everything else.
- ASCII: Ancient. Only supports basic English letters.
The Problem: If you save a file as UTF-8 (using 2 bytes for "é") but Excel reads it as ANSI (expecting 1 byte), it misinterprets the data. Result: Garbage text ("Mojibake").
How to Fix It
Method 1: The "Import" Trick in Excel
Don't double-click the CSV. That forces Excel to guess (and it often guesses wrong).
- Open a blank Excel workbook.
- Go to Data > Get Data > From Text/CSV.
- Select your file.
- In the preview window, look for "File Origin".
- Change it to "65001: Unicode (UTF-8)".
- Check the preview. Does "Café" look right?
- Click Load.
Method 2: Notepad (Windows)
You can use Notepad to convert the file.
- Right-click your CSV > Open with > Notepad.
- Does the text look correct here?
- Yes: The file is good, Excel just read it wrong. Go to step 3.
- No: The file itself is corrupted or saved in a very weird format.
- Click File > Save As.
- At the bottom, look for Encoding.
- Select UTF-8 (or "UTF-8 with BOM").
- Save.
Note: "UTF-8 with BOM" adds a hidden character at the start that tells Excel "Hey, I am UTF-8!". This often makes double-clicking work.
Method 3: TextEdit (Mac)
- Open TextEdit.
- Cmd+O to open.
- Select your file.
- Before clicking Open, click Options at the bottom.
- Change Plain Text Encoding to Unicode (UTF-8) (or try others if the preview looks wrong).
- Open, then Cmd+S to save (ensure UTF-8 is selected).
Method 4: Online Tools
If you don't want to fiddle with system settings, use a tool designed to fix this.
Preventing Encoding Issues
1. Always Export as UTF-8
When saving from any software, look for settings like "Export charset" or "Encoding". Always choose UTF-8.
2. Use the BOM (Byte Order Mark)
If you are generating CSVs for Excel users, add a BOM (\ufeff) at the very beginning of the file. This forces Excel to switch to UTF-8 mode.
Python Example:
import csv
with open('output.csv', 'w', newline='', encoding='utf-8-sig') as f:
writer = csv.writer(f)
writer.writerow(['Name', 'Café'])
utf-8-sig adds the BOM automatically.
3. Avoid "CSV (Macintosh)" or "CSV (MS-DOS)"
In Excel's Save As menu, these are traps. Just use CSV (Comma delimited) or CSV UTF-8 (Comma delimited).
Summary
- Weird characters = Encoding mismatch.
- UTF-8 is the solution.
- Don't double-click to open in Excel; use the Data Import tab.
- Convert legacy files using Notepad or a dedicated tool.
Encoding still broken? HappyCSV can detect and repair encoding issues instantly.
Related Articles
Anonymize CSV Data (GDPR/Testing)
How to mask sensitive data in CSV files. Anonymize names, emails, and phones for testing or GDPR compliance.
Batch Convert Multiple Excel Files to CSV
How to convert 100 Excel files to CSV at once. Use VBA macros, Python scripts, or batch converters to save hours of manual work.
Best Free CSV Viewers for Mac & Windows
Excel isn't the only way to open CSVs. Check out the best free CSV viewers like Tad, Miller, and online tools for large files.
Need to handle CSV files?
HappyCSV is the free, secure way to merge, split, and clean your data — all in your browser.