# error: unmappable character (0x80) for encoding UTF-8

- **ID:** `java/unmappable-character-encoding`
- **Domain:** java
- **Category:** encoding_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## 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.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Java 8 | active | — | — |
| Java 11 | active | — | — |
| Java 17 | active | — | — |
| Java 21 | active | — | — |

## Workarounds

1. **Specify the correct source encoding to javac using the -encoding flag. If the file is actually in Windows-1252, use -encoding Cp1252.** (90% success)
   ```
   Specify the correct source encoding to javac using the -encoding flag. If the file is actually in Windows-1252, use -encoding Cp1252.
   ```
2. **Convert the source file to UTF-8 using a tool like iconv or a text editor that supports encoding conversion.** (85% success)
   ```
   Convert the source file to UTF-8 using a tool like iconv or a text editor that supports encoding conversion.
   ```
3. **Use native2ascii to escape the unmappable character as a Unicode escape sequence.** (75% success)
   ```
   Use native2ascii to escape the unmappable character as a Unicode escape sequence.
   ```

## Dead Ends

- **** — Changing the system locale does not affect the javac encoding; the compiler encoding must be explicitly set. (95% fail)
- **** — Adding -Dfile.encoding=UTF-8 to JVM arguments does not affect javac compilation encoding. (90% fail)
- **** — Removing the character without understanding its origin may break the intended functionality (e.g., a special symbol in a string). (60% fail)
