From b1be1b45eeee21385a6d407a09e46af21f1af50e Mon Sep 17 00:00:00 2001
From: Niels <niels.lohmann@gmail.com>
Date: Sun, 15 Feb 2015 18:43:17 +0100
Subject: [PATCH] minor change

---
 src/json.hpp      | 2 +-
 src/json.hpp.re2c | 2 +-
 test/unit.cpp     | 7 +++++++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/json.hpp b/src/json.hpp
index 880b4229..bbffcfd3 100644
--- a/src/json.hpp
+++ b/src/json.hpp
@@ -1491,7 +1491,7 @@ class basic_json
 
                 default:
                 {
-                    if (c <= 0x1f)
+                    if (c >= 0 and c <= 0x1f)
                     {
                         // control characters (everything between 0x00 and 0x1f)
                         // -> create four-digit hex representation
diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c
index d8ef4107..148884a3 100644
--- a/src/json.hpp.re2c
+++ b/src/json.hpp.re2c
@@ -1491,7 +1491,7 @@ class basic_json
 
                 default:
                 {
-                    if (c <= 0x1f)
+                    if (c >= 0 and c <= 0x1f)
                     {
                         // control characters (everything between 0x00 and 0x1f)
                         // -> create four-digit hex representation
diff --git a/test/unit.cpp b/test/unit.cpp
index 78d3fd32..8110691d 100644
--- a/test/unit.cpp
+++ b/test/unit.cpp
@@ -1080,6 +1080,13 @@ TEST_CASE("object inspection")
             auto s = json(42.23).dump();
             CHECK(s.find("42.23") != std::string::npos);
         }
+
+        SECTION("dump and non-ASCII characters")
+        {
+            CHECK(json("ä").dump() == "\"ä\"");
+            CHECK(json("Ö").dump() == "\"Ö\"");
+            CHECK(json("❤️").dump() == "\"❤️\"");
+        }
     }
 
     SECTION("return the type of the object (explicit)")