ucs2

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidLength indicates the binary provided has an invalid (odd) length.
	ErrInvalidLength = errors.New("ucs2: length must be even")
)

Functions

func Decode

func Decode(src []byte) ([]rune, error)

Decode converts an array of UCS2 characters into an array of runes. As the UCS2 characters are packed into a byte array, the length of the byte array provided must be even.

func Encode

func Encode(src []rune) []byte

Encode converts an array of UCS2 runes into an array of bytes, where pairs of bytes (in Big Endian) represent a UCS2 character.

Types

type ErrDanglingSurrogate

type ErrDanglingSurrogate uint16

ErrDanglingSurrogate indicates only half of a suggorate pair is provided at the end of the byte array being decoded.

func (ErrDanglingSurrogate) Error

func (e ErrDanglingSurrogate) Error() string

func (ErrDanglingSurrogate) Surrogate

func (e ErrDanglingSurrogate) Surrogate() uint16

Surrogate returns the dangling surrogate.

Jump to

Keyboard shortcuts

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