mirror of
https://github.com/curl/curl.git
synced 2024-12-15 06:40:09 +08:00
tool_writeout_json: fix encoding of control characters
Control characters without a special escape sequence e.g. %00 or %06 were being encoded as "u0006" instead of "\u0006". Ref: https://github.com/curl/trurl/pull/214#discussion_r1257487858 Closes #11414
This commit is contained in:
parent
15b131352b
commit
8484ad09da
@ -62,7 +62,7 @@ void jsonWriteString(FILE *stream, const char *in, bool lowercase)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if(*i < 32) {
|
if(*i < 32) {
|
||||||
fprintf(stream, "u%04x", *i);
|
fprintf(stream, "\\u%04x", *i);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char out = *i;
|
char out = *i;
|
||||||
|
Loading…
Reference in New Issue
Block a user