HomeGuidesHow to Fix CSV Encoding Issues (Garbled Characters)
Guide

How to Fix CSV Encoding Issues (Garbled Characters)

3 methods — browser validator, Excel Import Wizard, and Python

CSV encoding issues appear as garbled text: accented characters like é or ñ show as ’ or ?, and imports fail with cryptic errors. The root cause is almost always a mismatch between how the file was saved (usually Windows-1252 or Latin-1) and how the receiving system expects it (UTF-8). Here's how to diagnose and fix it.

Method 1: Detect and validate using Tabular

  1. 1Upload your CSV to Tabular's CSV Validator.
  2. 2Tabular checks for encoding issues, null bytes, BOM markers, and malformed characters.
  3. 3If encoding issues are flagged, open the file in a code editor like VS Code.
  4. 4In VS Code, click the encoding indicator in the bottom-right status bar (e.g. 'UTF-8').
  5. 5Select 'Reopen with Encoding' and choose the correct encoding (try Windows-1252 or Latin-1 if UTF-8 shows garbage).
  6. 6Once the file displays correctly, go to File > Save with Encoding > UTF-8.
  7. 7Re-upload the re-saved file to Tabular for a clean import.

A BOM (Byte Order Mark) at the start of a UTF-8 file causes the first column header to appear as '\ufeffColumn Name'. VS Code's 'Save with Encoding > UTF-8' option saves without a BOM.

Method 2: Using Excel Import Wizard

  1. 1Do NOT double-click the CSV. Instead, open Excel and go to Data > From Text/CSV.
  2. 2Select your file. In the import dialog, look for 'File Origin' or 'Encoding'.
  3. 3Try different encodings — start with 65001 (UTF-8), then 1252 (Windows Latin) until the preview shows correct characters.
  4. 4Complete the import, then save as CSV via File > Save As, choosing 'CSV UTF-8 (Comma delimited)' to re-save in UTF-8.

Excel has a specific 'CSV UTF-8 (Comma delimited)' save format — use this, not the plain 'CSV (Comma delimited)' option, which saves in your system's default encoding.

Method 3: Using Python (chardet + re-encode)

  1. 1Install chardet: pip install chardet pandas
  2. 2Run the script below to auto-detect the encoding and re-save as UTF-8.

python

import chardet
import pandas as pd

# Step 1: Detect encoding
with open("input.csv", "rb") as f:
    result = chardet.detect(f.read())
    detected_encoding = result["encoding"]
    print(f"Detected encoding: {detected_encoding}")

# Step 2: Read with detected encoding and re-save as UTF-8
df = pd.read_csv("input.csv", encoding=detected_encoding)
df.to_csv("output_utf8.csv", index=False, encoding="utf-8")
print("Saved as UTF-8")

chardet's detection isn't always 100% accurate. If the output still looks wrong, try encoding='latin-1' or encoding='cp1252' manually in pd.read_csv().

Frequently asked questions

What causes CSV encoding issues?

Encoding issues occur when a CSV is saved in one character encoding (like Windows-1252 or Latin-1) but opened by software expecting a different encoding (usually UTF-8). Windows computers often produce Windows-1252 CSVs from Excel, while most web apps and databases expect UTF-8.

What is UTF-8 and why does it matter?

UTF-8 is the universal text encoding standard that supports all languages and special characters. It's the default for the web, databases, and most modern software. When in doubt, always save your CSV as UTF-8.

What is a BOM and should my CSV have one?

A BOM (Byte Order Mark) is an invisible marker at the start of a file that indicates the encoding. Some software adds it to UTF-8 files (called UTF-8 BOM or UTF-8 with BOM). Most systems handle it fine, but some — especially on Linux/Mac — will include it as part of the first column header, showing as a weird character prefix. Save as UTF-8 without BOM when possible.

Why do special characters like é show as ’ or ?

This is the classic sign of a UTF-8 file being read as Windows-1252 (or vice versa). The multi-byte UTF-8 sequence for é is being interpreted as separate Windows-1252 characters. Re-open the file with the correct encoding using VS Code or the Python method above.

Ready to try the fastest method?

Validate your CSV file and get a detailed report of formatting issues, encoding problems, and inconsistencies.

CSV Validator — free