Fix #137: better handling of unicode in torrent names
This commit is contained in:
parent
226fd0d051
commit
7147f16042
1 changed files with 4 additions and 7 deletions
|
|
@ -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) => {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue