Skip to main content

decode

Function decode 

Source
pub fn decode(bytes: &[u8]) -> Result<String, EncodingError>
Expand description

Decode a YAML byte stream to a UTF-8 String, stripping any BOM.

Detects encoding via detect_encoding, converts to UTF-8, and removes the BOM character if present.

ยงErrors

Returns EncodingError if the byte stream is not valid for the detected encoding, contains an invalid Unicode codepoint, or is truncated (odd-length UTF-16 or non-multiple-of-four UTF-32).