From 65791201f9407ebe1d23293430c705f9c7fb5053 Mon Sep 17 00:00:00 2001 From: "Pierre G. Bogossian" Date: Fri, 26 Aug 2016 18:46:00 +0200 Subject: [PATCH] Fix for a bug in unicode surrogate pair handling eg: the JSON string "\ud841\udf31" should contain the character with the unicode scalar value U+20731, not U+10731 --- json.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json.c b/json.c index 6012bad7..1b2bb639 100644 --- a/json.c +++ b/json.c @@ -328,7 +328,7 @@ json_value * json_parse_ex (json_settings * settings, uc_b2 = (uc_b3 << 4) | uc_b4; uchar2 = (uc_b1 << 8) | uc_b2; - uchar = 0x010000 | ((uchar & 0x3FF) << 10) | (uchar2 & 0x3FF); + uchar = 0x010000 + ((uchar & 0x3FF) << 10) | (uchar2 & 0x3FF); } if (sizeof (json_char) >= sizeof (json_uchar) || (uchar <= 0x7F))