Skip to content

Commit

Permalink
Merge pull request #1800 from triska/nbsp
Browse files Browse the repository at this point in the history
FIXED: consistent read/write of further control characters, and non-breaking space
  • Loading branch information
mthom committed May 5, 2023
2 parents c5a3ec3 + d8edf7b commit e4b19dc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/heap_print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ 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.
'\u{0}'..='\u{1f}' | '\u{7f}' ..= '\u{a0}'
// print all other control characters, and also non-breaking space, in hex.
=> format!("\\x{:x}\\", c as u32),
_ => c.to_string(),
}
}
Expand Down

0 comments on commit e4b19dc

Please sign in to comment.