escape_path_human_readable

Function escape_path_human_readable 

Source
pub fn escape_path_human_readable(path: &Path) -> String
Expand description

Formats a filesystem path into a human-readable, valid UTF-8 string, escaping invalid UTF-8 bytes and control characters as \xHH hex escapes.

On POSIX/Unix systems, paths are read as raw native bytes; on Windows, paths are read as canonical WTF-8 bytes via OsStr::as_encoded_bytes(). Any invalid UTF-8 bytes (including unpaired surrogates in WTF-8) and control characters are losslessly escaped as \xHH.