pub fn find_invalid_utf8(buf: &[u8]) -> Option<usize>Expand description
Find the offset of the first byte that is not part of a strictly valid UTF-8
sequence, mirroring Git’s find_invalid_utf8 (commit.c).
This is stricter than core::str::from_utf8: in addition to rejecting
malformed/overlong sequences and surrogates, it also rejects the Unicode
non-characters U+xxFFFE, U+xxFFFF, and the range U+FDD0..=U+FDEF, which
Rust’s standard library accepts. Returns None when the whole buffer is valid.