Skip to main content

decode_utf8_or_latin1_owned

Function decode_utf8_or_latin1_owned 

pub fn decode_utf8_or_latin1_owned(bytes: Vec<u8>) -> String
Expand description

Decode owned bytes as UTF-8, falling back to ISO-8859-1 (Latin-1) when the complete input is not valid UTF-8.

The valid UTF-8 path reuses the input allocation. The fallback maps every byte directly to the Unicode code point with the same value.