From 2a1a2a0a71e6eaee72a5287d39412760beeedd1a Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Wed, 21 Jan 2015 11:58:51 +0000 Subject: [PATCH] Fix (maybe) JSON escaping. I've obviously never tested this code! --- net_io.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/net_io.c b/net_io.c index 40937bb..2d5cb9e 100644 --- a/net_io.c +++ b/net_io.c @@ -712,12 +712,7 @@ static const char *jsonEscapeString(const char *str) { *out++ = '\\'; *out++ = ch; } else if (ch < 32 || ch > 127) { - *out++ = '\\'; - *out++ = 'u'; - *out++ = '0'; - *out++ = '0'; - *out++ = (ch >> 4) & 0x0f; - *out++ = ch & 0x0f; + out += snprintf(out, end - out, "\\u%04x", ch); } else { *out++ = ch; }