How decoding one character went.
CONVERSION_OK means a character was decoded. SOURCE_EXHAUSTED means the input ended in the middle of a character.
SOURCE_ILLEGAL means the bytes are not valid UTF-8. Both decoding modes report it for a broken byte structure; strict
decoding also reports it for a decoded value that is not a Unicode scalar.
cut := u8.[0xe2, 0x82]; // the start of a three byte character
_, _, status := character_utf8_to_utf32(cut.data, 2, true);
assert(status == .SOURCE_EXHAUSTED);
stray := u8.[0x80]; // a continuation byte with nothing before it
_, _, status = character_utf8_to_utf32(stray.data, 1, true);
assert(status == .SOURCE_ILLEGAL);Members
- CONVERSION_OK
- SOURCE_EXHAUSTED
- SOURCE_ILLEGAL