parse_utf8

Function parse_utf8 

Source
pub fn parse_utf8(utf8: &[u8], preserve_invalid_bytes: bool) -> Vec<TCodepoint> ⓘ
Expand description

Decode every codepoint in a UTF-8 byte slice.

When preserve_invalid_bytes is false (the C++ default), an invalid byte aborts decoding and the result is the single-element vector [INVALID_UTF8]. When true, each invalid byte is pushed as its raw u8 value (widened to TCodepoint) and decoding continues. Faithful to C++ ParseUTF8. Decoding stops at the first NUL byte, matching the C-string semantics of the original.