Skip to main content

decode_utf8_slow_path

Function decode_utf8_slow_path 

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

Decode a sequence of UTF8 encoded bytes when it is known that the first byte is a start of a UTF8 sequence. Port of _decodeUTF8SlowPath (UTF8.h:77-162), reading bytes from *i and advancing *i past the consumed bytes. On malformed input it invokes error and returns the replacement character.

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