Commit 1b6ec98
committed
Don't add null bytes in serialize::json::Encoder::write_char
This fixes rust-lang#19514 using a two-line patch suggested by @lifthrasiir. The
code snippet:
```rust
extern crate serialize;
fn main() {
let s = serialize::json::encode(&'c');
println!("Encoded: {}, bytes: {}", s, s.as_bytes());
}
```
...serialized 'c' as `[34, 99, 0, 0, 0, 34]` when it should have used
`[34, 99, 34]`. A test case is included.1 parent da83ad8 commit 1b6ec98
1 file changed
+9
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
371 | | - | |
| 370 | + | |
| 371 | + | |
372 | 372 | | |
373 | 373 | | |
374 | 374 | | |
| |||
2413 | 2413 | | |
2414 | 2414 | | |
2415 | 2415 | | |
2416 | | - | |
| 2416 | + | |
2417 | 2417 | | |
2418 | 2418 | | |
2419 | 2419 | | |
| |||
2536 | 2536 | | |
2537 | 2537 | | |
2538 | 2538 | | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
2539 | 2545 | | |
2540 | 2546 | | |
2541 | 2547 | | |
| |||
0 commit comments