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 thecharset
parameter of theContent-Type
header.)environment_encoding
: An optionalEncoding
object for the environment encoding, if any.
Returns a 2-tuple of a decoded Unicode string and the Encoding
object that was used.