Function charset::decode_latin1

source ·
pub fn decode_latin1<'a>(bytes: &'a [u8]) -> Cow<'a, str>
Expand description

Converts bytes whose unsigned value is interpreted as Unicode code point (i.e. U+0000 to U+00FF, inclusive) to UTF-8.

This is useful for decoding non-conforming header names such that the names stay unique and the decoding cannot fail (except for allocation failure).

Borrows if input is ASCII-only. Performs a single heap allocation otherwise.