Documentation
¶
Overview ¶
Package utf16 implements encoding and decoding of UTF-16 sequences.
Index ¶
- func AppendRunes(dst []uint16, src ...rune) []uint16
- func DecodeRune(r1, r2 rune) rune
- func EncodeRune(r rune) (r1, r2 rune)
- func EncodeRunes(dst []uint16, s ...rune) ([]uint16, int)
- func EncodedSize(s string) int
- func IsSurrogate(r rune) bool
- func RunesAppend(dst []rune, utf16 ...uint16) []rune
- func RunesDecode(d []rune, src ...uint16) (dst []rune, n int)
- func UTF8Append(dst []byte, src ...uint16) []byte
- func UTF8Decode(dst []byte, utf16 ...uint16) ([]byte, int)
- func UTF8DecodedSize(utf16 ...uint16) (n int, canDecodeInPlace bool)
- type String
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendRunes ¶
AppendRunes appends the UTF-16 encoding of the Unicode code point sequence src to dst.
func DecodeRune ¶
DecodeRune returns the UTF-16 decoding of a surrogate pair. If the pair is not a valid UTF-16 surrogate pair, DecodeRune returns the Unicode replacement code point U+FFFD.
func EncodeRune ¶
EncodeRune returns the UTF-16 surrogate pair r1, r2 for the given rune.
If the rune is not a valid Unicode code point or does not need encoding, EncodeRune returns U+FFFD, U+FFFD.
func EncodedSize ¶
EncodedSize returns the number of uint16s required to hold the UTF-16 encoding of unicode code points in s.
func IsSurrogate ¶
IsSurrogate reports whether the specified Unicode code point can appear in a surrogate pair.
func RunesAppend ¶
RunesAppend decodes all UTF-16 code points in src into the dst, returns the decoded runes.
func RunesDecode ¶
RunesDecode decodes UTF-16 code points in src into the dst, returns updated dst and count of consumed uint16s from src.
func UTF8Append ¶
func UTF8Decode ¶
UTF8Decode transcodes UTF-16 encoding of unicode code points to UTF-8 bytes, returns updated dst and count of consumed uint16s from src.
func UTF8DecodedSize ¶
UTF8DecodedSize returns UTF-8 bytes required to store the decoded UTF-16 encoding of unicode code points.