pub fn bytes_text(bytes: &[u8]) -> StringExpand description
Renders raw bytes of an archive name as text, by the rules of
path_text.
Valid UTF-8 is kept as it is except for backslashes (\x5C), and each
invalid byte is written \xNN. Use it for names that are held as bytes, as
they are stored in the archive, so two names that differ only in invalid
bytes never render alike.
ยงExamples
use exarch_core::bytes_text;
assert_eq!(bytes_text(b"caf\xc3\xa9"), "caf\u{e9}");
assert_eq!(bytes_text(b"caf\xe9"), "caf\\xE9");
assert_ne!(bytes_text(b"caf\xe9"), bytes_text(b"caf\xe8"));