aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPhilipp Stephani2016-10-24 21:54:51 +0200
committerPhilipp Stephani2017-01-01 13:24:14 +0100
commit93be35e038bbb19e8d64d3c1f9d1be76a9083d09 (patch)
tree7a9074fa83d51aa8136f57be267c83016c4f3978 /test
parentbaa370f255d2f9d3f662fac0de98eaadd3242aa6 (diff)
downloademacs-93be35e038bbb19e8d64d3c1f9d1be76a9083d09.tar.gz
emacs-93be35e038bbb19e8d64d3c1f9d1be76a9083d09.zip
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')
-rw-r--r--test/lisp/json-tests.el3
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."
167 (should (equal (json-read-string) "abcαβγ"))) 167 (should (equal (json-read-string) "abcαβγ")))
168 (json-tests--with-temp-buffer "\"\\nasd\\u0444\\u044b\\u0432fgh\\t\"" 168 (json-tests--with-temp-buffer "\"\\nasd\\u0444\\u044b\\u0432fgh\\t\""
169 (should (equal (json-read-string) "\nasdфывfgh\t"))) 169 (should (equal (json-read-string) "\nasdфывfgh\t")))
170 ;; Bug#24784
171 (json-tests--with-temp-buffer "\"\\uD834\\uDD1E\""
172 (should (equal (json-read-string) "\U0001D11E")))
170 (json-tests--with-temp-buffer "foo" 173 (json-tests--with-temp-buffer "foo"
171 (should-error (json-read-string) :type 'json-string-format))) 174 (should-error (json-read-string) :type 'json-string-format)))
172 175