Function stfu8::encode_u8

source ·
pub fn encode_u8(v: &[u8]) -> String
Expand description

Encode text as STFU-8, escaping all non-printable or non UTF-8 bytes.

Examples


let encoded = stfu8::encode_u8(b"foo\xFF\nbar");
assert_eq!(
    encoded,
    r"foo\xFF\nbar" // notice the `r` == raw string
);