Skip to main content

label_to_encoding

Function label_to_encoding 

Source
pub fn label_to_encoding(label: &str) -> Encoding
Expand description

Map a WHATWG encoding label to our Encoding enum. Unknown labels fall through to Encoding::Other which routes to encoding_rs (when the full-encodings feature is on) or errors out.

Common labels covered inline so we don’t always go through encoding_rs. Note: WHATWG explicitly maps iso-8859-1 to Windows-1252 because legacy web content labels Latin-1 documents that actually use Win1252 characters.