Skip to main content

detect_encoding

Function detect_encoding 

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

Detect the encoding of a YAML byte stream via BOM or null-byte heuristic.

Implements YAML 1.2 ยง5.2 encoding detection. UTF-32 BOMs are checked before UTF-16 because the UTF-32 LE BOM (FF FE 00 00) is a superset of the UTF-16 LE BOM (FF FE).