UTF(7)
π UTF β character set and format π
ok so this is the page for UTF, Unicode, ASCII, and rune β bestie, it's literally the whole character set and format situation, from the Plan 9 misc info manual. Buckle up π
β¨ NAME β¨
UTF, Unicode, ASCII, rune β character set and format. that's the whole squad π«Ά
π DESCRIPTION π
okay so here's the tea β β the Plan 9 character set and its representation are based on the Unicode Standard and on the ISO multibyte UTF-8 encoding. yes, that's Universal Character Set Transformation Format, 8 bits wide β the full government name, no cap π
so like, the Unicode Standard represents its characters in 16 bits, and UTF-8 represents such values in an 8-bit byte stream. cute, right? and throughout this manual, UTF-8 is shortened to UTF β just so we're not typing the whole thing every single time, iykyk π
π¦ what even is a rune tho
in Plan 9, a rune is a 16-bit quantity representing a Unicode character. internally, programs may store characters as runes. but β and this is the key part, bestie β any external manifestation of textual information, like in files or at the interface between programs, uses a machine-independent, byte-stream encoding called UTF. so runes are the inner-circle vibe, UTF is the public-facing main character energy β¨
πΈ the ASCII compatibility slay
UTF is designed so the 7-bit ASCII set (values hexadecimal 00 to 7F) appear only as themselves in the encoding. iconic behaviour honestly.
runes with values above 7F show up as sequences of two or more bytes with values only from 80 to FF.
the UTF encoding of the Unicode Standard is backward compatible with ASCII π«Ά:
- programs presented only with ASCII work on Plan 9 even if not written to deal with UTF β periodt
- same goes for programs that deal with uninterpreted byte streams
- however (and this is the plot twist π), programs that perform semantic processing on ASCII graphic characters must convert from UTF to runes in order to work properly with non-ASCII input. see
rune(3)π
π§ the conversion math (yes we're doing binary, stay with me)
letting numbers be binary, a rune x is converted to a multibyte UTF sequence as follows:
01. x in [00000000.0bbbbbbb] β 0bbbbbbb
10. x in [00000bbb.bbbbbbbb] β 110bbbbb, 10bbbbbb
11. x in [bbbbbbbb.bbbbbbbb] β 1110bbbb, 10bbbbbb, 10bbbbbb
conversion 01 provides a one-byte sequence that spans the ASCII character set in a compatible way π
conversions 10 and 11 represent higher-valued characters as sequences of two or three bytes with the high bit set.
π¨ important vibe check: Plan 9 does not support the 4, 5, and 6 byte sequences proposed by X-Open. not invited to the party, sorry not sorry π
when there are multiple ways to encode a value β for example rune 0 β the shortest encoding is used. efficiency queen π
π the inverse mapping (reverse uno card)
in the inverse mapping, any sequence except those described above is incorrect and is converted to rune hexadecimal 0080. wrong vibe = bounced straight to 0080, no questions asked π
π₯ SEE ALSO π₯
go read those, bestie, they're literally so good π
and that's the page!! this one's from the Plan 9 Miscellaneous Information Manual, filed under UTF(7) β footer and all, same UTF(7) energy at the bottom as at the top π mwah, ily, go encode something cute ππ¦
π¦ where this page comes from
- alpine 3.24: plan9port-doc 0_git20260208-r0 Β· LPL-1.02
- arch rolling: plan9port 20261021-2 Β· custom
- nixos 26.05: plan9port 0-unstable-2025-11-10
- nixos 26.05: plan9port-wayland 0-unstable-2025-11-26
- nixpkgs unstable: plan9port 0-unstable-2025-11-10
- nixpkgs unstable: plan9port-wayland 0-unstable-2025-11-26
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms