From 7147f16042bdfa1cca2f8192d59079137b2bd672 Mon Sep 17 00:00:00 2001 From: Igor Katson Date: Fri, 21 Jun 2024 12:22:13 +0100 Subject: [PATCH] Fix #137: better handling of unicode in torrent names --- crates/buffers/src/lib.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/buffers/src/lib.rs b/crates/buffers/src/lib.rs index 54f750ce..51385a75 100644 --- a/crates/buffers/src/lib.rs +++ b/crates/buffers/src/lib.rs @@ -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) => {}