From a37f65471c2b69fa588cbf8e9794ff1fe6d04605 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 31 Mar 2022 09:30:08 +0200 Subject: types: fix escape sequence encoding of high byte values in JSON strings Treat the char value as unsigned when testing its value to yield consistent results on both platforms with signed chars and those with unsigned chars by default (e.g. ARM ones). This also avoids encoding byte values > 127 as \uXXXX escape sequences, potentially breaking the strng contents. Fixes: #62 Signed-off-by: Jo-Philipp Wich --- tests/custom/03_stdlib/01_chr | 2 +- tests/custom/03_stdlib/27_sprintf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/custom') 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", -- cgit v1.2.3