Bug #335 ยป bugfix.diff
src/htsmsg_json.c (working copy) | ||
---|---|---|
37 | 37 |
htsbuf_append(hq, "\"", 1); |
38 | 38 | |
39 | 39 |
while(*s != 0) { |
40 |
if(*s == '"' || *s == '\\' || *s == '\n') { |
|
40 |
if(*s == '"' || *s == '\\' || *s == '\n' || *s == '\t' || *s == '\r') {
|
|
41 | 41 |
htsbuf_append(hq, str, s - str); |
42 | 42 | |
43 | 43 |
if(*s == '"') |
44 | 44 |
htsbuf_append(hq, "\\\"", 2); |
45 | 45 |
else if(*s == '\n') |
46 | 46 |
htsbuf_append(hq, "\\n", 2); |
47 |
else if(*s == '\t') |
|
48 |
htsbuf_append(hq, "\\t", 2); |
|
49 |
else if(*s == '\r') |
|
50 |
htsbuf_append(hq, "\\r", 2); |
|
47 | 51 |
else |
48 | 52 |
htsbuf_append(hq, "\\\\", 2); |
49 | 53 |
s++; |