Skip to content

Commit

Permalink
Fix #137: better handling of unicode in torrent names
Browse files Browse the repository at this point in the history
  • Loading branch information
ikatson committed Jun 21, 2024
1 parent 226fd0d commit 7147f16
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions crates/buffers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {}
Expand Down

0 comments on commit 7147f16

Please sign in to comment.