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) {
|
match std::str::from_utf8(b) {
|
||||||
Ok(s) => {
|
Ok(s) => {
|
||||||
// A test if all chars are "printable".
|
if debug_strings {
|
||||||
if s.chars().all(|c| c.escape_debug().len() == 1) {
|
return write!(f, "{s:?}");
|
||||||
if debug_strings {
|
} else {
|
||||||
return write!(f, "{s:?}");
|
return write!(f, "{s}");
|
||||||
} else {
|
|
||||||
return write!(f, "{s}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(_e) => {}
|
Err(_e) => {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue