Invalid UTF-8 bytes
character-encoding, utf-8
Solution
You're just confusing terms:
The codepoint U+00C0 is the character "À", U+00C1 is "Á". Encoded in UTF-8 they're the byte sequence `C3 80` and `C3 81` respectively.
The bytes `C0` and `C1` should never appear in the UTF-8 encoding.
Codepoints denote characters independently of bytes. Bytes are bytes.
Problem
According to Wikipedia: Not all sequences of bytes are valid UTF-8. A UTF-8 decoder should be prepared for: ``` 1. the red invalid bytes in the above table 2. an unexpected continuation byte 3. a start byte not followed by enough continuation bytes 4. an Overlong Encoding as described above 5. A 4-byte sequence (starting with 0xF4) that decodes to a value greater than U+10FFFF ``` As per the Codepage layout, `0xC0` and `0xC1` are invalid and must never appear in a valid UTF-8 sequence. Here is what I have for CodePoints `0xC0` and `0xC1`: ``` Byte 2 Byte 1 Num Char 11000011 10000000 192 À 11000011 10000001 193 Á ``` There are characters corresponding to these byte sequences, while there should not be. Am I doing it wrong?