Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnknown = errors.New("unknown character set")
Error of a character set name that no character set answers to
Functions ¶
func Canonical ¶
Canonical name of a character set label in any spelling, false when no character set answers to it
func Decode ¶
Text of bytes in the named character set, a *DecodeError for bytes it cannot decode or ErrUnknown for an unknown name
func DecodeReplace ¶
Text of bytes in the named character set with every undecodable sequence turned into U+FFFD, the error only ErrUnknown for an unknown name
Types ¶
type DecodeError ¶
type DecodeError struct {
Charset string // canonical name of the character set
Offset int // offset of the first byte of the sequence that does not decode, always inside the input
Reason string // what is wrong with that sequence
}
Bytes that are not valid text in a character set, found at a byte offset of the input
func (*DecodeError) Error ¶
func (e *DecodeError) Error() string
Message naming the offset, the character set and the reason
type EncodeError ¶
type EncodeError struct {
Charset string // canonical name of the character set
Offset int // byte offset of the character in the text
Char rune // the character, -1 when the text is not valid UTF-8 at Offset
}
Text holding a character the character set has no bytes for, or text that is not valid UTF-8
func (*EncodeError) Error ¶
func (e *EncodeError) Error() string
Message naming the character, its offset and the character set