summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tests/custom/03_stdlib/01_chr2
-rw-r--r--tests/custom/03_stdlib/27_sprintf4
-rw-r--r--types.c3
3 files changed, 5 insertions, 4 deletions
diff --git a/tests/custom/03_stdlib/01_chr b/tests/custom/03_stdlib/01_chr
index 17163e3..47fdb17 100644
--- a/tests/custom/03_stdlib/01_chr
+++ b/tests/custom/03_stdlib/01_chr
@@ -22,6 +22,6 @@ passed to the `chr()` function.
[
"",
"abc",
- "\u0000\u0000\u0000\u0000\u0000AB\u00ff"
+ "\u0000\u0000\u0000\u0000\u0000ABÿ"
]
-- End --
diff --git a/tests/custom/03_stdlib/27_sprintf b/tests/custom/03_stdlib/27_sprintf
index e1a3c5d..5606e9a 100644
--- a/tests/custom/03_stdlib/27_sprintf
+++ b/tests/custom/03_stdlib/27_sprintf
@@ -235,8 +235,8 @@ string value.
"1E-07",
"NAN",
"A",
- "\u00ff",
- "\u00c8",
+ "ÿ",
+ "È",
"\u0000",
"\"Hello\\n\"",
"123",
diff --git a/types.c b/types.c
index 6f60f59..5707ce9 100644
--- a/types.c
+++ b/types.c
@@ -1405,10 +1405,11 @@ ucv_to_string_json_encoded(uc_stringbuf_t *pb, const char *s, size_t len, bool r
break;
default:
- if (*s < 0x20)
+ if ((unsigned char)*s < 0x20)
ucv_stringbuf_printf(pb, "\\u%04x", (unsigned char)*s);
else
ucv_stringbuf_addstr(pb, s, 1);
+
break;
}
}