Function charset::decode_ascii

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

Converts ASCII to UTF-8 with non-ASCII bytes replaced with the REPLACEMENT CHARACTER.

This is can be used for strict MIME compliance when there is no declared encoding.

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