{
  "id": "data/csv-encoding-mismatch-latin1",
  "signature": "CSV file silently corrupts special characters when opened in Excel due to Latin-1 vs UTF-8 encoding mismatch",
  "signature_zh": "由于Latin-1与UTF-8编码不匹配，CSV文件在Excel中打开时特殊字符静默损坏",
  "regex": "CSV.*encoding|special characters.*corrupted|Excel.*CSV.*garbled",
  "domain": "data",
  "category": "encoding_error",
  "subcategory": null,
  "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.",
  "root_cause_type": "generic",
  "root_cause_zh": "Excel默认假定CSV文件使用Latin-1（Windows-1252）编码，而现代数据工具以UTF-8导出，导致ü、ñ或€等字符显示为乱码。",
  "versions": [
    {
      "version": "Microsoft Excel 2021",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Microsoft Excel 365",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "LibreOffice Calc 7.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding UTF-8 BOM to the file without verifying Excel version compatibility",
      "why_fails": "UTF-8 BOM may cause Excel to detect encoding correctly but adds invisible characters to first column header.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Converting file to UTF-16 which Excel supports but causes other issues",
      "why_fails": "This changes the data format and may break downstream systems expecting UTF-8.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Add UTF-8 BOM to the CSV file: echo -e '\\xEF\\xBB\\xBF' > output.csv; cat original.csv >> output.csv; then open in Excel",
      "success_rate": 0.9,
      "how": "Add UTF-8 BOM to the CSV file: echo -e '\\xEF\\xBB\\xBF' > output.csv; cat original.csv >> output.csv; then open in Excel",
      "condition": "",
      "sources": []
    },
    {
      "action": "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())",
      "success_rate": 0.85,
      "how": "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())",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Add UTF-8 BOM to the CSV file: echo -e '\\xEF\\xBB\\xBF' > output.csv; cat original.csv >> output.csv; then open in Excel",
    "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())"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://support.microsoft.com/en-us/office/import-or-export-text-txt-or-csv-files-5250ac4c-663c-47ce-937b-d0b5f933c3a9",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-03-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}