We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 026f49b commit f523b41Copy full SHA for f523b41
json/src/ser.rs
@@ -494,9 +494,12 @@ pub fn escape_bytes<W>(wr: &mut W, bytes: &[u8]) -> Result<()>
494
try!(wr.write_all(b"\""));
495
496
let mut start = 0;
497
- let mut last_byte_was_c2 = false;
+ let mut last_byte = 0u8;
498
499
for (i, byte) in bytes.iter().enumerate() {
500
+ let last_byte_was_c2 = last_byte == b'\xC2';
501
+ last_byte = *byte;
502
+
503
let escaped = match *byte {
504
b'"' => b"\\\"",
505
b'\\' => b"\\\\",
@@ -527,10 +530,6 @@ pub fn escape_bytes<W>(wr: &mut W, bytes: &[u8]) -> Result<()>
527
530
528
531
continue;
529
532
},
- b'\xC2' => {
- last_byte_was_c2 = true;
- continue;
533
- },
534
_ => { continue; }
535
};
536
0 commit comments