Function cssparser::decode_stylesheet_bytes [] [src]

pub fn decode_stylesheet_bytes(css: &[u8],
                               protocol_encoding_label: Option<&str>,
                               environment_encoding: Option<EncodingRef>)
                               -> (String, EncodingRef)

Determine the character encoding of a CSS stylesheet and decode it.

This is based on the presence of a BOM (Byte Order Mark), an @charset rule, and encoding meta-information.

  • css_bytes: A byte string.
  • protocol_encoding: The encoding label, if any, defined by HTTP or equivalent protocol. (e.g. via the charset parameter of the Content-Type header.)
  • environment_encoding: An optional Encoding object for the environment encoding, if any.

Returns a 2-tuple of a decoded Unicode string and the Encoding object that was used.