Skip to main content
Data Standardization

Handling Special Characters and Encoding Issues in Data

é, ’, and □□□ in your data aren't corrupted — they're encoding errors. Here's what causes them and how to fix them before they break your imports and reports.

Special character and encoding issues occur when text data is stored or transferred using one character encoding but read using a different one — converting perfectly normal text into garbled sequences of strange symbols. The fix is to detect the encoding, specify it explicitly, and convert everything to UTF-8.

If you've ever opened a CSV and seen "é" where you expected "é", or "’" where you expected an apostrophe, or □□□ for what should be Chinese characters — you've encountered a character encoding problem. These aren't corrupted files. They're files where the encoding was misidentified.

What Character Encoding Actually Is

Every text character is stored as one or more bytes. A character encoding is the specification of which byte values correspond to which characters. Different encodings were developed for different languages and regions:

  • ASCII: The original 7-bit encoding covering English characters only
  • Latin-1 / ISO-8859-1: Extends ASCII to cover Western European languages
  • Windows-1252 (CP1252): Microsoft's extension of Latin-1, very common in Windows-generated files
  • UTF-8: A variable-width encoding that covers all Unicode characters — the modern standard
  • UTF-16: Another Unicode encoding, often used in Windows systems
  • Shift-JIS: Japanese encoding; GB2312/GBK: Chinese encodings

When a file written in Windows-1252 is opened as UTF-8, certain byte sequences that represent one character in Windows-1252 are interpreted as different (or invalid) characters in UTF-8 — producing the garbled output.

Sohovi profiles your datasets for quality issues in minutes — see what's broken before it breaks your pipeline — try Sohovi free.

The Most Common Encoding Scenarios

Scenario 1: Windows-1252 read as UTF-8. The curly apostrophe (') stored as byte 0x92 in Windows-1252 becomes "’" in UTF-8 (because UTF-8 interprets that byte sequence differently). This is the most common encoding problem in business data from Windows-generated files.

Scenario 2: Latin-1 read as UTF-8. Accented characters like "é" stored as a single byte in Latin-1 (0xE9) become "é" when misread as UTF-8 (because UTF-8 expects two bytes for that character).

Scenario 3: UTF-8 file with a BOM read incorrectly. Some files start with a Byte Order Mark (BOM) — a special byte sequence indicating byte order. If a reader doesn't handle the BOM, it appears as "" at the start of the file.

How to Fix Encoding Issues

Step 1: Detect the encoding. Use a detection tool — Python's chardet library, the Notepad++ Encoding menu, or the file command in Unix — to identify the actual encoding of the file.

Step 2: Convert to UTF-8. Once you know the source encoding, convert to UTF-8:

  • In Python: open(file, encoding='cp1252').read() then save(file, encoding='utf-8')
  • In Excel: File → Save As → choose "CSV UTF-8 (comma delimited)"
  • In Notepad++: Encoding menu → Convert to UTF-8

Step 3: Validate the conversion. Open the converted file and check that previously garbled characters now display correctly.

Sohovi lets you set up validation rules for any column and instantly see which rows fall outside them — no code or SQL required.

Preventing Encoding Issues Going Forward

  • Always specify UTF-8 when saving CSV files from Excel
  • Add an encoding declaration at the top of any file that might be misidentified
  • Validate encoding at import — before processing any file, confirm it's UTF-8 or explicitly handle the conversion

Frequently Asked Questions

Q: What causes special character encoding issues in data files? Encoding issues occur when a file written in one character encoding is read using a different one. The most common cause is Windows-1252 files (common output from Microsoft Excel on Windows) being read as UTF-8 — the default encoding on modern systems.

Q: What is the difference between UTF-8 and UTF-16? Both are Unicode encodings that can represent all Unicode characters. UTF-8 uses variable-length encoding (1–4 bytes per character) and is fully backward compatible with ASCII. UTF-16 uses 2 or 4 bytes per character and is not backward compatible with ASCII. UTF-8 is the standard for web and most data applications; UTF-16 is more common in certain Windows and Java contexts.

Q: Why do Excel CSV exports often have encoding problems? Excel saves CSV files in the regional encoding of the operating system by default — Windows-1252 on Windows US systems. When these files are opened on a different system or processed by a tool expecting UTF-8, encoding mismatches produce garbled characters. The fix is to use Excel's "CSV UTF-8 (comma delimited)" save option.

Q: How do I detect the encoding of a file without specialized tools? Open the file in a text editor and look for garbled characters. Check the file extension and origin — files from Windows systems are likely Windows-1252; files from modern web applications are likely UTF-8. Python's chardet library can programmatically detect encoding with reasonable accuracy.

Q: What is a BOM (Byte Order Mark) and when is it a problem? A BOM is a special byte sequence at the start of a file that indicates the file's encoding and byte order. In UTF-8 files, the BOM is optional. When present, it appears as "" if misread as Latin-1. Some tools handle it correctly; others don't. For maximum compatibility, save UTF-8 files without a BOM unless specifically required.

Q: Can I fix encoding issues in a spreadsheet without programming? For simple cases: open the file in Notepad++ (free text editor), choose the current encoding from the Encoding menu, then convert to UTF-8. For Excel files: File → Save As → "CSV UTF-8 (comma delimited)." For bulk conversion, command-line tools like iconv are available without programming skills.

Q: What happens if I try to save a file with characters that the target encoding doesn't support? Characters that can't be represented in the target encoding are either replaced with a substitution character (?) or cause an error. This is why UTF-8 is the recommended target — it supports all Unicode characters, so nothing is lost during conversion.

Q: How do I handle encoding issues in data from multiple international sources? Establish UTF-8 as the required encoding for all incoming data. In your data intake process, detect the encoding of each incoming file and convert to UTF-8 before processing. Document the encoding conversion as part of your data lineage.

Q: Does encoding affect data quality checks? Yes. Encoding problems can cause values that look identical visually to not match in exact string comparisons — because the underlying bytes are different. This can produce false negatives in deduplication, validation, and search operations. Fix encoding before running any data quality checks.

Q: Why is UTF-8 the recommended encoding standard? UTF-8 covers all Unicode characters (every character used in every human language), is backward compatible with ASCII (the lowest 128 characters of UTF-8 are identical to ASCII), is the default encoding for the web, and is supported by virtually every modern application and database. It's the safest, most universal choice.


Encoding issues aren't corrupted data — they're a labeling problem. Once you know the correct encoding, the fix takes minutes. Standardize to UTF-8 for all future data and you'll never see this problem again.

Selva Santosh

Data quality, for people who ship

Selva writes practical guides on data quality, profiling, and governance to help teams ship better data.

Start for free

Stop guessing. Start knowing your data quality.

Sohovi profiles your datasets in minutes — surfacing completeness gaps, type mismatches, and duplicate patterns before they reach production.

No credit card required · Free forever plan