# CSV file silently corrupts special characters when opened in Excel due to Latin-1 vs UTF-8 encoding mismatch

- **ID:** `data/csv-encoding-mismatch-latin1`
- **Domain:** data
- **Category:** encoding_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

Excel assumes CSV files are encoded in Latin-1 (Windows-1252) by default, while modern data tools export in UTF-8, causing characters like ü, ñ, or € to display as garbled text.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Microsoft Excel 2021 | active | — | — |
| Microsoft Excel 365 | active | — | — |
| LibreOffice Calc 7.5 | active | — | — |

## Workarounds

1. **Add UTF-8 BOM to the CSV file: echo -e '\xEF\xBB\xBF' > output.csv; cat original.csv >> output.csv; then open in Excel** (90% success)
   ```
   Add UTF-8 BOM to the CSV file: echo -e '\xEF\xBB\xBF' > output.csv; cat original.csv >> output.csv; then open in Excel
   ```
2. **Use Python to convert CSV to Latin-1 encoding: with open('input.csv', 'r', encoding='utf-8') as f, open('output.csv', 'w', encoding='latin-1') as out: out.write(f.read())** (85% success)
   ```
   Use Python to convert CSV to Latin-1 encoding: with open('input.csv', 'r', encoding='utf-8') as f, open('output.csv', 'w', encoding='latin-1') as out: out.write(f.read())
   ```

## Dead Ends

- **Adding UTF-8 BOM to the file without verifying Excel version compatibility** — UTF-8 BOM may cause Excel to detect encoding correctly but adds invisible characters to first column header. (60% fail)
- **Converting file to UTF-16 which Excel supports but causes other issues** — This changes the data format and may break downstream systems expecting UTF-8. (75% fail)
