Skip to main content

transcode_to_utf8_as

Function transcode_to_utf8_as 

Source
pub fn transcode_to_utf8_as(
    bytes: &[u8],
    encoding: Encoding,
) -> Result<Cow<'_, [u8]>>
Expand description

Transcode bytes into UTF-8 assuming they are in the given encoding.

Use this when you already know the encoding (e.g. from an HTTP Content-Type header) and want to skip detection. Returns an error for encodings not yet supported (currently anything beyond Tier 1).