Skip to main content

Module utf8x

Module utf8x 

Source
Expand description

UTF-8 encoding for TeX characters.

TeX characters are code points 0–0x10FFFF, including surrogates, which LuaTeX encodes like any other value (a superset of standard UTF-8, as in WTF-8). Strings of TeX characters are therefore kept as byte vectors.

Functions§

chars
Decodes a whole byte string into characters.
decode
Decodes the character starting at bytes[i], returning it and its length. Malformed sequences decode as their first byte (length 1), which is how LuaTeX treats invalid input bytes.
encode
The encoding of a single character.
len
Number of bytes in the encoding of c.
push
Appends the encoding of c to out.
single_char
If bytes encodes exactly one character, returns it.