diff options
author | Philipp Stephani <phst@google.com> | 2016-10-24 21:54:51 +0200 |
---|---|---|
committer | Philipp Stephani <phst@google.com> | 2017-01-01 13:24:14 +0100 |
commit | 93be35e038bbb19e8d64d3c1f9d1be76a9083d09 (patch) | |
tree | 7a9074fa83d51aa8136f57be267c83016c4f3978 /test/lisp/json-tests.el | |
parent | baa370f255d2f9d3f662fac0de98eaadd3242aa6 (diff) | |
download | emacs-93be35e038bbb19e8d64d3c1f9d1be76a9083d09.tar.gz |
Fix encoding of JSON surrogate pairs
JSON requires that such pairs be treated as UTF-16 surrogate pairs, not
individual code points; cf. Bug #24784.
* lisp/json.el (json-read-escaped-char): Fix decoding of surrogate
pairs.
(json--decode-utf-16-surrogates): New defun.
* test/lisp/json-tests.el (test-json-read-string): Add test for
surrogate pairs.
Diffstat (limited to 'test/lisp/json-tests.el')
-rw-r--r-- | test/lisp/json-tests.el | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/lisp/json-tests.el b/test/lisp/json-tests.el index 66fc25ad1c0..38672de0664 100644 --- a/test/lisp/json-tests.el +++ b/test/lisp/json-tests.el @@ -167,6 +167,9 @@ Point is moved to beginning of the buffer." (should (equal (json-read-string) "abcαβγ"))) (json-tests--with-temp-buffer "\"\\nasd\\u0444\\u044b\\u0432fgh\\t\"" (should (equal (json-read-string) "\nasdфывfgh\t"))) + ;; Bug#24784 + (json-tests--with-temp-buffer "\"\\uD834\\uDD1E\"" + (should (equal (json-read-string) "\U0001D11E"))) (json-tests--with-temp-buffer "foo" (should-error (json-read-string) :type 'json-string-format))) |