| UTF8(7) | Miscellaneous Information Manual | UTF8(7) |
utf8 — UTF-8 text
encoding
UTF-8 is a multibyte character encoding for Unicode text. It is the preferred format for non ASCII text.
Unicode codepoints are encoded as follows:
The bits shown as dots contain the codepoint represented as a binary integer.
Bytes starting with the bit pattern 11...... are called UTF-8 start bytes, and those starting with 10...... UTF-8 continuation bytes. The number of leading 1 bits in a start byte indicates the total number of bytes used to encode the codepoint, including the start byte.
Encodings using more bytes than required are invalid. In particular, 11000000 and 11000001 are not valid start bytes, the byte after 11100000 must be at least 10100000, and the byte after 11110000 must be at least 10010000.
The ranges U+D800 to U+DFFF and U+110000 to U+1FFFFF do not contain valid Unicode codepoints. Consequently, the corresponding three- and four-byte UTF-8 sequences are invalid. The highest valid byte after 11101101 is 10011111, the highest valid byte of the form 1111.... is 11110100, and the highest valid byte after 11110100 is 10001111.
To summarize, the following is a complete list of bytes that are invalid in all contexts:
The following is a complete list of invalid two-byte combinations of the form 11...... 10...... that consist of two valid bytes:
F. Yergeau, UTF-8, a transformation format of ISO 10646, RFC 3629, November 2003.
| February 18, 2022 | Debian |