Skip to main content

Module encoding

Module encoding 

Source
Expand description

Text encoding utilities for metadata decoding.

Many file formats store text metadata in Latin-1 (ISO 8859-1) or other non-UTF-8 encodings. These helpers provide correct decoding instead of the lossy String::from_utf8_lossy() which silently replaces bytes

= 0x80 with U+FFFD.

Functions§

decode_latin1
Decode bytes as Latin-1 (ISO 8859-1) to String.
decode_utf8_or_latin1
Try decoding as UTF-8 first; fall back to Latin-1 if invalid.