From 75d719d2048b483ab169c0f455b5e96d393e01a5 Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Thu, 17 Mar 2022 18:43:30 -0600 Subject: [PATCH] print most characters directly ((#1355) --- src/heap_print.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/heap_print.rs b/src/heap_print.rs index 944b30d8..7d00c0d0 100644 --- a/src/heap_print.rs +++ b/src/heap_print.rs @@ -176,11 +176,15 @@ fn char_to_string(is_quoted: bool, c: char) -> String { '\'' | '\n' | '\r' | '\t' | '\u{0b}' | '\u{0c}' | '\u{08}' | '\u{07}' | '"' | '\\' => { c.to_string() } + '\u{0}'..='\u{1f}' => format!("\\x{:x}", c as u32), // print all other control characters in hex. + _ => c.to_string(), + /* '\u{a0}'..='\u{d6}' => c.to_string(), '\u{d8}'..='\u{f6}' => c.to_string(), '\u{f8}'..='\u{74f}' => c.to_string(), '\x20'..='\x7e' => c.to_string(), _ => format!("\\x{:x}\\", c as u32), + */ } } -- 2.54.0