Skip to content

Commit

Permalink
Merge pull request #95 from janfh/fix/issue94_unicode_escape
Browse files Browse the repository at this point in the history
Fix for issue #94: Escape \u if following 4 characters is not hex digits
  • Loading branch information
NielsLiisberg authored Dec 13, 2024
2 parents f430c95 + 79596bc commit 1d5288f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/serializer.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ static void jx_EncodeJsonStream (PSTREAM p , PUCHAR in)
}
}
else if (c == pJw->backSlash) {
if (in[1] != 'u') { // Dont double escape unicode escape sequence
// Dont double escape unicode escape sequence
if (strlen(in) < 6 || in[1] != 'u'
|| !isxdigit(in[2]) || !isxdigit(in[3])
|| !isxdigit(in[4]) || !isxdigit(in[5])) {
stream_putc(p,pJw->backSlash);
}
}
Expand Down

0 comments on commit 1d5288f

Please sign in to comment.