diff --git a/src/json.hpp b/src/json.hpp index 459f7f3d..bc6fd709 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -5967,7 +5967,7 @@ class basic_json { return (v < 10) ? ('0' + static_cast(v)) - : ('a' + static_cast((v - 10) & 0xff)); + : ('a' + static_cast((v - 10) & 0x1f)); }; // print character c as \uxxxx diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 685024a5..793cc738 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -5967,7 +5967,7 @@ class basic_json { return (v < 10) ? ('0' + static_cast(v)) - : ('a' + static_cast((v - 10) & 0xff)); + : ('a' + static_cast((v - 10) & 0x1f)); }; // print character c as \uxxxx