Skip to main content

detect_encoding

Function detect_encoding 

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

Automatic detection of the XML encoding using the recommended algorithm.

Returns Some with a DetectedEncoding (which reports the BOM length, if any) when the encoding is recognized, otherwise None.

The algorithm examines up to the first four bytes to determine the encoding.