pub fn probe_encoding(data: &[u8]) -> ProbeResultExpand description
Probe the encoding of an XML document from its initial bytes.
Inspects up to the first ~128 bytes for:
- Byte Order Mark (BOM): UTF-8, UTF-16 LE/BE, UTF-32 LE/BE
- XML declaration
<?xml ... encoding="..."?>
The main parser assumes UTF-8. Callers that need to support other
encodings should use this function to detect the encoding and
transcode before feeding data to Reader::parse().
Returns Encoding::Unknown if the input is too short to determine encoding.