Skip to content

Commit

Permalink
tool_writeout_json: fix encoding of control characters
Browse files Browse the repository at this point in the history
Control characters without a special escape sequence e.g. %00 or %06
were being encoded as "u0006" instead of "\u0006".

Ref: curl/trurl#214 (comment)
Closes curl#11414
  • Loading branch information
emanuele6 authored and bch committed Jul 19, 2023
1 parent 5ac4ea8 commit 45d28aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tool_writeout_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void jsonWriteString(FILE *stream, const char *in, bool lowercase)
break;
default:
if(*i < 32) {
fprintf(stream, "u%04x", *i);
fprintf(stream, "\\u%04x", *i);
}
else {
char out = *i;
Expand Down

0 comments on commit 45d28aa

Please sign in to comment.