Skip to content

Instantly share code, notes, and snippets.

@masakielastic
Last active May 24, 2024 08:40
Show Gist options
  • Save masakielastic/cdf720efe2cbecd6f2ce684302f1acf4 to your computer and use it in GitHub Desktop.
Save masakielastic/cdf720efe2cbecd6f2ce684302f1acf4 to your computer and use it in GitHub Desktop.
Output (Go 1.22.3)
C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4
D5 D6 D7 D8 D9 DA DB DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9
EA EB EC ED EE EF F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF
package main
import (
"fmt"
"unicode/utf8"
)
func main() {
for i := range 0xFF+1 {
if i > 0x80 && utf8.RuneStart(byte(i)) {
fmt.Printf("%X ", i)
}
}
fmt.Println()
}
Table 3-7. Well-Formed UTF-8 Byte Sequences
https://www.unicode.org/versions/Unicode15.0.0/ch03.pdf
Code Points First Byte Second Byte Third Byte Fourth Byte
U+0000..U+007F 00..7F
U+0080..U+07FF C2..DF 80..BF
U+0800..U+0FFF E0 A0..BF 80..BF
U+1000..U+CFFF E1..EC 80..BF 80..BF
U+D000..U+D7FF ED 80..9F 80..BF
U+E000..U+FFFF EE..EF 80..BF 80..BF
U+10000..U+3FFFF F0 90..BF 80..BF 80..BF
U+40000..U+FFFFF F1..F3 80..BF 80..BF 80..BF
U+100000..U+10FFFF F4 80..8F 80..BF 80..BF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment