From 0feadcbec4e50807aa4d5870f27725a6ffe6330b Mon Sep 17 00:00:00 2001 From: Kevin Brubeck Unhammer Date: Fri, 18 Dec 2020 12:28:21 +0100 Subject: [PATCH] \x1f should be escaped in json Might help with https://github.com/divvun/divvun-gramcheck-web/issues/23 https://tools.ietf.org/html/rfc7159 says "escape U+0000 through U+001F", we were escaping up to but not including 1F, simple fix :) --- src/json.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/json.hpp b/src/json.hpp index ad49138..256fbf0 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -59,7 +59,7 @@ inline const std::string esc(const std::u16string& str) { default: auto ci = (int)c; if((sizeof(c) == 1 || static_cast(c) < 256) - && (ci<0x1f || + && (ci<=0x1f || ci==0x7f || (ci>=0x80 && ci<=0x9f) || c == '\\' ||