Skip to main content

declared_encoding

Function declared_encoding 

Source
pub fn declared_encoding(bytes: &[u8]) -> Option<String>
Expand description

The encoding an HTML document declares in its head — a <meta charset=…> or a <meta http-equiv="content-type" content="…; charset=…"> within the first 1024 bytes, as the HTML standard’s prescan reads them — reported for the engine’s source boundary. The adapter decodes nothing. An XML prologue on an XHTML page counts too (the XML adapter’s rule, applied here so a page served as text/html still declares). A charset= inside any other attribute’s value (a description) declares nothing.