pub fn check_valid_utf8(bytes: &[u8]) -> Result<(), ErrorData>Expand description
Checks whether bytes form a valid UTF-8 string according to DuckDB’s
validator (DuckDB 1.5.0+).
DuckDB’s rules match Rust’s: every Unicode scalar value is accepted, and
surrogates, overlong encodings, code points above U+10FFFF, truncated
sequences and stray continuation bytes are rejected, exactly where
std::str::from_utf8 rejects them (checked over all 1,112,064 scalar
values and each malformed class). Use this when you want DuckDB’s
structured ErrorData for the failure; for a yes/no answer,
std::str::from_utf8 is equivalent and needs no engine.
§Errors
Returns the structured ErrorData describing the first validation failure.