diff --git a/json/src/JSON/Internal.ss b/json/src/JSON/Internal.ss index 8cfb4060..a2fe92c6 100644 --- a/json/src/JSON/Internal.ss +++ b/json/src/JSON/Internal.ss @@ -194,7 +194,7 @@ (fxsll (fx- w1 #xD800) 10) (fx- w2 #xDC00)) #x10000) - (error #f (format "Invalid unicode surrogate pair ~a ~a" w1 w2))))] + (error #f (format "Invalid unicode surrogate pair ~,x ~,x" w1 w2))))] [(fx<= #xDC00 w1 #xDFFF) (error #f (format "Invalid unicode escape ~,x" w1))] [else w1]))) diff --git a/json/test/Main.ss b/json/test/Main.ss index 03d2d1c9..9cab4afa 100644 --- a/json/test/Main.ss +++ b/json/test/Main.ss @@ -69,6 +69,7 @@ (assert-roundtrip "\" \\uD801\\uDC37 foo\"" "\" 𐐷 foo\"") (assert-fail "\"\\uD801 \"" "Unexpected ' ', was expecting '\\'") (assert-fail "\"\\uDC37 \"" "Invalid unicode escape DC37") + (assert-fail "\" \\uD801\\uD802 foo\"" "Invalid unicode surrogate pair D801 D802") (display " Leading whitespace\n") (assert-roundtrip "\n\r \"\\nbar\"" "\"\\nbar\"")