Skip to main content

encode_declared_with

Function encode_declared_with 

Source
pub fn encode_declared_with(
    text: &str,
    encoding: &str,
    opts: &MergeOptions,
) -> Result<Vec<u8>, Error>
Expand description

encode_text_with for an HTML page (a format whose LocOS filter reads with declared=True). LocOS rewrites every charset declaration of a converted page to UTF-8 when it reads it and, when the page has no label of its own to give back (its only declaration sits past the first 4096 characters, so it never named the page’s charset), writes the page as UTF-8: the gate in encode_like finds a declaration that does not name the code page. Under the LocOS profile a legacy page with no label and such a late declaration does the same. Native mode keeps the declaration as content and the code page, as before.