envzn
0.8 · beta · not released

Library / System / Codecs / TextEncoding

CLASS

TextEncoding

Methods 4

METHOD appendUTF8(MUTABLE REFERENCE binary[] dst, REFERENCE String s, int64 off, int64 n) RETURNS void
reads

Append the UTF-8 of s's code points [off, off + n) to dst. The window is bounds-checked; a String's code points are always Unicode scalars, so this cannot fail.

METHOD stringFromCString(HANDLE s) RETURNS String
reads

The String a C string's UTF-8 spells: a FOREIGN result, a main argument. A null pointer is the empty String. Bytes that are not UTF-8 give the empty String too, as the decoder reports them.

METHOD stringFromBytes(HANDLE p, int64 n) RETURNS String
reads

The String of the n UTF-8 bytes at p, which is C memory the caller keeps.

METHOD utf8Of(REFERENCE String s) RETURNS char8[]
reads

The UTF-8 of s. A String's code points are scalars, so this cannot fail.