Package utf8internal contains low-level utf8-related constants, tables, etc. that are used internally by the text package.
const ( LoCB = 0x80 // 1000 0000 HiCB = 0xBF // 1011 1111 )
The default lowest and highest continuation byte.
const ( // ASCII identifies a UTF-8 byte as ASCII. ASCII = as // FirstInvalid indicates a byte is invalid as a first byte of a UTF-8 // sequence. FirstInvalid = xx // SizeMask is a mask for the size bits. Use use x&SizeMask to get the size. SizeMask = 7 // AcceptShift is the right-shift count for the first byte info byte to get // the index into the AcceptRanges table. See AcceptRanges. AcceptShift = 4 )
Constants related to getting information of first bytes of UTF-8 sequences.
AcceptRanges is a slice of AcceptRange values. For a given byte sequence b
will give the value of AcceptRange for the multi-byte UTF-8 sequence starting at b.
First is information about the first byte in a UTF-8 sequence.
AcceptRange gives the range of valid values for the second byte in a UTF-8 sequence for any value for First that is not ASCII or FirstInvalid.