{
  "id": "java/unmappable-character-encoding",
  "signature": "error: unmappable character (0x80) for encoding UTF-8",
  "signature_zh": "错误：无法映射的字符 (0x80) 用于编码 UTF-8",
  "regex": "error: unmappable character \\(0x[0-9a-fA-F]+\\) for encoding UTF-8",
  "domain": "java",
  "category": "encoding_error",
  "subcategory": null,
  "root_cause": "The Java source file contains a byte sequence that is not valid in the UTF-8 encoding specified for the compiler, often due to a non-UTF-8 character (e.g., from Windows-1252 or ISO-8859-1) being present in a string literal or comment.",
  "root_cause_type": "generic",
  "root_cause_zh": "Java 源文件包含编译器指定的 UTF-8 编码中无效的字节序列，通常是由于字符串字面量或注释中存在非 UTF-8 字符（例如来自 Windows-1252 或 ISO-8859-1）。",
  "versions": [
    {
      "version": "Java 8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Java 11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Java 17",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Java 21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Changing the system locale does not affect the javac encoding; the compiler encoding must be explicitly set.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Adding -Dfile.encoding=UTF-8 to JVM arguments does not affect javac compilation encoding.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Removing the character without understanding its origin may break the intended functionality (e.g., a special symbol in a string).",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Specify the correct source encoding to javac using the -encoding flag. If the file is actually in Windows-1252, use -encoding Cp1252.",
      "success_rate": 0.9,
      "how": "Specify the correct source encoding to javac using the -encoding flag. If the file is actually in Windows-1252, use -encoding Cp1252.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Convert the source file to UTF-8 using a tool like iconv or a text editor that supports encoding conversion.",
      "success_rate": 0.85,
      "how": "Convert the source file to UTF-8 using a tool like iconv or a text editor that supports encoding conversion.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use native2ascii to escape the unmappable character as a Unicode escape sequence.",
      "success_rate": 0.75,
      "how": "Use native2ascii to escape the unmappable character as a Unicode escape sequence.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Specify the correct source encoding to javac using the -encoding flag. If the file is actually in Windows-1252, use -encoding Cp1252.",
    "Convert the source file to UTF-8 using a tool like iconv or a text editor that supports encoding conversion.",
    "Use native2ascii to escape the unmappable character as a Unicode escape sequence."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#options",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-01-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}