Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CharWidth [256]byte
Lookup table for UTF-8 character byte counts. Set to the byte count of the character for start bytes, zero otherwise.
View Source
var StartByteIndicator [256]byte
Lookup table for UTF-8 start bytes. Set to 1 for start bytes, zero otherwise.
Functions ¶
This section is empty.
Types ¶
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator checks whether a byte string is valid UTF-8 text. It rejects invalid start bytes, missing continuation bytes, surrogate code points, overlong byte sequences, and 4-byte sequences outside the Unicode range.
func NewValidator ¶
func NewValidator() *Validator
func (*Validator) ValidateBytes ¶
ValidateBytes checks if appending bytes to the bytes processed so far would produce invalid UTF-8 text.
func (*Validator) ValidateEnd ¶
ValidateEnd checks whether the bytes are valid UTF-8 once all bytes have been processed.
Click to show internal directories.
Click to hide internal directories.