utf16

Constants & Variables

maxRune const #

const maxRune = '\U0010FFFF'

replacementChar const #

const replacementChar = '\uFFFD'

surr1 const #

0xd800-0xdc00 encodes the high 10 bits of a pair. 0xdc00-0xe000 encodes the low 10 bits of a pair. the value is those 20 bits plus 0x10000.

const surr1 = 0xd800

surr2 const #

const surr2 = 0xdc00

surr3 const #

const surr3 = 0xe000

surrSelf const #

const surrSelf = 0x10000

Functions

AppendRune function #

AppendRune appends the UTF-16 encoding of the Unicode code point r to the end of p and returns the extended buffer. If the rune is not a valid Unicode code point, it appends the encoding of U+FFFD.

func AppendRune(a []uint16, r rune) []uint16

Decode function #

Decode returns the Unicode code point sequence represented by the UTF-16 encoding s.

func Decode(s []uint16) []rune

DecodeRune function #

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 DecodeRune(r1 rune, r2 rune) rune

Encode function #

Encode returns the UTF-16 encoding of the Unicode code point sequence s.

func Encode(s []rune) []uint16

EncodeRune function #

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 EncodeRune(r rune) (r1 rune, r2 rune)

IsSurrogate function #

IsSurrogate reports whether the specified Unicode code point can appear in a surrogate pair.

func IsSurrogate(r rune) bool

RuneLen function #

RuneLen returns the number of 16-bit words in the UTF-16 encoding of the rune. It returns -1 if the rune is not a valid value to encode in UTF-16.

func RuneLen(r rune) int

decode function #

decode appends to buf the Unicode code point sequence represented by the UTF-16 encoding s and return the extended buffer.

func decode(s []uint16, buf []rune) []rune

Generated with Arrow