Files
moli/moli-encoding/src/lib.rs
T
ldm0 707d829ba7 fix(xhr): decode response bytes using the response encoding
Honor response and override charsets, BOMs, and XML or HTML encoding
declarations across buffered, queued, and streaming delivery. Reuse the
HTML document decoder with UTF-8 fallback and expose its selected charset.
Keep JSON decoding fixed to UTF-8 and binary responses byte-exact.

Select the decoder after HEADERS_RECEIVED handlers can change the MIME
override. Keep queued response bytes intact and handle split BOMs and
multibyte characters in streaming text.
2026-09-27 06:43:22 +08:00

31 lines
916 B
Rust

//! Browser-compatible text, document, form, script, and URL encoding helpers.
mod document;
mod form;
mod labels;
mod legacy_text;
mod percent;
mod query;
mod script;
mod xhr;
pub use document::{
HtmlDocumentStreamingDecoder, LegacyEncodingDetector, decode_html_document,
decode_html_document_with_fallback,
};
pub use form::{
encode_text_for_legacy_web, form_output_encoding, form_output_encoding_for_label,
form_submission_encoding, form_urlencoded_serialize_pairs, is_charset_sentinel_name,
};
pub use labels::{
charset_from_content_type, charset_from_headers, encoding_for_label,
encoding_for_response_charset, encoding_from_response_headers,
};
pub use legacy_text::decode_text_for_legacy_web;
pub use query::encode_url_query_for_legacy_web;
pub use script::{decode_classic_script_source, decode_utf8};
pub use xhr::{XhrResponseDecoder, XhrResponseTextKind};
#[cfg(test)]
mod tests;