Skip to main content

decode_string

Function decode_string 

Source
pub fn decode_string(data: &[u8]) -> Option<(StringEncoding, String)>
Expand description

Attempt to decode data as a printable ASCII or UTF-16LE string.

Both encodings tolerate a single trailing NUL terminator (the common C / Windows-W convention). Returns the decoded text and the encoding it was read under, but only when every character is printable; otherwise the blob has no clean string reading and the caller should fall back to the \xNN hex form.