pub fn decode_stylesheet<'b>(
css: &'b [u8],
protocol: Option<&str>,
environment: Option<&'static Encoding>,
) -> (Cow<'b, str>, &'static Encoding)Expand description
Decodes a stylesheet’s bytes, returning the text and the encoding it was in. Malformed bytes become U+FFFD.
let (text, encoding) = parsec_css::decode_stylesheet(b"@charset \"iso-8859-5\"; @\xe9", None, None);
assert_eq!((&*text, encoding.name()), ("@charset \"iso-8859-5\"; @щ", "ISO-8859-5"));