# CSV file with UTF-8 encoded data displays as garbled text when opened in Excel or other tools expecting Latin-1

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

## Root Cause

CSV files are saved with UTF-8 encoding but the reader or application (e.g., Excel) defaults to Latin-1 (ISO 8859-1), causing extended characters to be misinterpreted.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| pandas 1.5.0 | active | — | — |
| Python 3.10 | active | — | — |
| Excel 365 | active | — | — |
| LibreOffice 7.4 | active | — | — |

## Workarounds

1. **Re-save the CSV with explicit UTF-8 encoding using Python: df.to_csv('file.csv', encoding='utf-8-sig') to add BOM for Excel compatibility.** (85% success)
   ```
   Re-save the CSV with explicit UTF-8 encoding using Python: df.to_csv('file.csv', encoding='utf-8-sig') to add BOM for Excel compatibility.
   ```
2. **Open the CSV in a text editor, then use 'Save As' with UTF-8 encoding. In Excel, use Data > From Text/CSV and select '65001: Unicode (UTF-8)' as the file origin.** (90% success)
   ```
   Open the CSV in a text editor, then use 'Save As' with UTF-8 encoding. In Excel, use Data > From Text/CSV and select '65001: Unicode (UTF-8)' as the file origin.
   ```

## Dead Ends

- **Manually changing file extension to .txt and re-importing** — Does not address the underlying encoding issue; the data remains corrupted during import. (90% fail)
- **Using a hex editor to remove the UTF-8 BOM** — Removing BOM only affects byte order mark, not the actual encoding; data still garbled if reader assumes Latin-1. (70% fail)
