utf8

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2024 License: GPL-3.0 Imports: 0 Imported by: 0

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

func (v *Validator) ValidateBytes(buf []byte) bool

ValidateBytes checks if appending bytes to the bytes processed so far would produce invalid UTF-8 text.

func (*Validator) ValidateEnd

func (v *Validator) ValidateEnd() bool

ValidateEnd checks whether the bytes are valid UTF-8 once all bytes have been processed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL