diff options
author | Tom Gundersen <teg@jklm.no> | 2014-12-22 14:53:40 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-12-22 20:27:20 +0100 |
commit | 9bae67d49b861b1f142f1a1e27753fe08e63ade7 (patch) | |
tree | 8e3b1d2d0c34558b17344526923697f5ea382c8d /src/test/test-json.c | |
parent | shared: utf8 - support decoding the full utf16 (diff) | |
download | systemd-9bae67d49b861b1f142f1a1e27753fe08e63ade7.tar.xz systemd-9bae67d49b861b1f142f1a1e27753fe08e63ade7.zip |
shared: json - support escaping utf16 surrogate pairs
We originally only supported escaping ucs2 encoded characters (as \uxxxx). This
only covers the BMP. Support escaping also utf16 surrogate pairs (on the form
\uxxxx\uyyyy) to cover all of unicode.
Diffstat (limited to 'src/test/test-json.c')
-rw-r--r-- | src/test/test-json.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/test/test-json.c b/src/test/test-json.c index e53e8ed50f..b09131891c 100644 --- a/src/test/test-json.c +++ b/src/test/test-json.c @@ -99,6 +99,9 @@ int main(int argc, char *argv[]) { test_one("\"\xef\xbf\xbd\"", JSON_STRING, "\xef\xbf\xbd", JSON_END); test_one("\"\\ufffd\"", JSON_STRING, "\xef\xbf\xbd", JSON_END); test_one("\"\\uf\"", -EINVAL); + test_one("\"\\ud800a\"", -EINVAL); + test_one("\"\\udc00\\udc00\"", -EINVAL); + test_one("\"\\ud801\\udc37\"", JSON_STRING, "\xf0\x90\x90\xb7", JSON_END); return 0; } |