Skip to main content

declared_encoding

Function declared_encoding 

Source
pub fn declared_encoding(bytes: &[u8]) -> Option<String>
Expand description

The encoding an XML document declares in its prologue (<?xml version="1.0" encoding="windows-1251"?>), reported for the engine’s source boundary. The adapter decodes nothing: the boundary applies the declaration after ?encoding= and a byte-order mark have had their say. The prologue is scanned as ASCII-compatible bytes, as the XML recommendation’s appendix F reads it; a document whose first bytes are not <?xml declares nothing.