Skip to main content

decode_utf8

Function decode_utf8 

Source
pub fn decode_utf8<const ALLOW_SURROGATES: bool>(
    bytes: &[u8],
    i: &mut usize,
    error: impl FnMut(&str),
) -> u32
Expand description

Decode a sequence of UTF8 encoded bytes into a Unicode codepoint, ASCII fast path. Port of decodeUTF8 (UTF8.h:187-193). In case of decoding errors, the provided callback is invoked with an appropriate message and UNICODE_REPLACEMENT_CHARACTER is returned.

\tparam ALLOW_SURROGATES when false, values in the surrogate range are reported as errors.