|
|
|
@ -620,41 +620,14 @@ pub fn print_quoted_str(string: &str, f: &mut impl Write) -> fmt::Result { |
|
|
|
|
f.write_char('"')?; |
|
|
|
|
for c in string.chars() { |
|
|
|
|
match c { |
|
|
|
|
'\0' => f.write_str("\\u0000"), |
|
|
|
|
'\u{01}' => f.write_str("\\u0001"), |
|
|
|
|
'\u{02}' => f.write_str("\\u0002"), |
|
|
|
|
'\u{03}' => f.write_str("\\u0003"), |
|
|
|
|
'\u{04}' => f.write_str("\\u0004"), |
|
|
|
|
'\u{05}' => f.write_str("\\u0005"), |
|
|
|
|
'\u{06}' => f.write_str("\\u0006"), |
|
|
|
|
'\u{07}' => f.write_str("\\u0007"), |
|
|
|
|
'\u{08}' => f.write_str("\\b"), |
|
|
|
|
'\t' => f.write_str("\\t"), |
|
|
|
|
'\n' => f.write_str("\\n"), |
|
|
|
|
'\u{0b}' => f.write_str("\\u000B"), |
|
|
|
|
'\u{0c}' => f.write_str("\\f"), |
|
|
|
|
'\r' => f.write_str("\\r"), |
|
|
|
|
'\u{0e}' => f.write_str("\\u000E"), |
|
|
|
|
'\u{0f}' => f.write_str("\\u000F"), |
|
|
|
|
'\u{10}' => f.write_str("\\u0010"), |
|
|
|
|
'\u{11}' => f.write_str("\\u0011"), |
|
|
|
|
'\u{12}' => f.write_str("\\u0012"), |
|
|
|
|
'\u{13}' => f.write_str("\\u0013"), |
|
|
|
|
'\u{14}' => f.write_str("\\u0014"), |
|
|
|
|
'\u{15}' => f.write_str("\\u0015"), |
|
|
|
|
'\u{16}' => f.write_str("\\u0016"), |
|
|
|
|
'\u{17}' => f.write_str("\\u0017"), |
|
|
|
|
'\u{18}' => f.write_str("\\u0018"), |
|
|
|
|
'\u{19}' => f.write_str("\\u0019"), |
|
|
|
|
'\u{1a}' => f.write_str("\\u001A"), |
|
|
|
|
'\u{1b}' => f.write_str("\\u001B"), |
|
|
|
|
'\u{1c}' => f.write_str("\\u001C"), |
|
|
|
|
'\u{1d}' => f.write_str("\\u001D"), |
|
|
|
|
'\u{1e}' => f.write_str("\\u001E"), |
|
|
|
|
'\u{1f}' => f.write_str("\\u001F"), |
|
|
|
|
'"' => f.write_str("\\\""), |
|
|
|
|
'\\' => f.write_str("\\\\"), |
|
|
|
|
'\u{7f}' => f.write_str("\\u007F"), |
|
|
|
|
'\0'..='\u{1f}' | '\u{7f}' => write!(f, "\\u{:04X}", u32::from(c)), |
|
|
|
|
c => f.write_char(c), |
|
|
|
|
}?; |
|
|
|
|
} |
|
|
|
|