Function openvet_common::util::escape_invalid_utf8
source ยท pub fn escape_invalid_utf8(bytes: &[u8]) -> StringExpand description
Escape invalid UTF-8, so that it can be un-escaped without being lossy.
We need this because path names in Tar archives are just bytes, meaning that they can contain arbitrary (non-valid UTF-8) names. We need some way of encoding them as regular strings, so that we can use them in the API (for example, JSON only supports UTF-8 keys in its maps).