nulib.text.unicode.utf8

UTF-8 Utilities

Members

Functions

decode
codepoint decode(const(char)[4] utf, size_t read)

Decodes a UTF-8 character

decode
codepoint decode(const(char)[4] utf)

Decodes the specified UTF-8 character

decode
UnicodeSequence decode(inout(char)[] str)

Decodes a string to a vector of codepoints. Invalid codes will be replaced with unicodeReplacementCharacter

encode
nstring encode(UnicodeSlice slice)

Encodes a series of unicode codepoints to UTF-8

encode
nstring encode(UnicodeSequence sequence)

Encodes a series of unicode codepoints to UTF-8

getLength
size_t getLength(char c)

Gets the expected byte-size of the specified character

getUTF8Length
size_t getUTF8Length(codepoint code)

Gets how many utf-16 units are in the specified codepoint

validate
bool validate(const(char)[4] seq)

Validates a utf-8 character sequence.

validate
bool validate(inout(char)[] str)

Returns whether the given nstring is a valid UTF-8 string

Meta

Authors

Luna Nielsen