Function decode_utf8_or_latin1
pub fn decode_utf8_or_latin1(bytes: &[u8]) -> Cow<'_, str>Expand description
Decode bytes as UTF-8, falling back to ISO-8859-1 (Latin-1) when the complete input is not valid UTF-8.
Valid UTF-8 is returned borrowed and does not allocate. The fallback maps every byte directly to the Unicode code point with the same value; it is deliberately not lossy UTF-8 decoding and not Windows-1252 decoding.