Function cssparser::from_bytes::stylesheet_encoding
source ยท pub fn stylesheet_encoding<E>(
css: &[u8],
protocol_encoding_label: Option<&[u8]>,
environment_encoding: Option<E::Encoding>,
) -> E::Encodingwhere
E: EncodingSupport,
Expand description
Determine the character encoding of a CSS stylesheet.
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] (https://drafts.csswg.org/css-syntax/#environment-encoding), if any.
Returns the encoding to use.