Fix #137: better handling of unicode in torrent names

This commit is contained in:
Igor Katson 2024-06-21 12:22:13 +01:00
parent 226fd0d051
commit 7147f16042
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5

View file

@ -46,13 +46,10 @@ fn debug_bytes(b: &[u8], f: &mut std::fmt::Formatter<'_>, debug_strings: bool) -
}
match std::str::from_utf8(b) {
Ok(s) => {
// A test if all chars are "printable".
if s.chars().all(|c| c.escape_debug().len() == 1) {
if debug_strings {
return write!(f, "{s:?}");
} else {
return write!(f, "{s}");
}
if debug_strings {
return write!(f, "{s:?}");
} else {
return write!(f, "{s}");
}
}
Err(_e) => {}