diff options
author | Dmitry Gutov <dgutov@yandex.ru> | 2015-03-25 21:54:29 +0200 |
---|---|---|
committer | Dmitry Gutov <dgutov@yandex.ru> | 2015-03-25 21:54:29 +0200 |
commit | 58c86059c60bc27e9eadba5735da5a40b47f6005 (patch) | |
tree | 88b49d8b41f36d173824c96184588ebdfec27f17 /lisp/json.el | |
parent | 2b828866c2df5ea558283e4c3f4c79a404918bea (diff) | |
download | emacs-58c86059c60bc27e9eadba5735da5a40b47f6005.tar.gz |
Only escape quotation mark, backslash and cntrl U+0000 to U+001F
* lisp/json.el (json-special-chars): Don't treat `/' specially, there's
no need to.
(json-encode-string): Only escape quotation mark, backslash and
the control characters U+0000 to U+001F.
Diffstat (limited to 'lisp/json.el')
-rw-r--r-- | lisp/json.el | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/json.el b/lisp/json.el index a1e9bb78d11..eaf8596a6dc 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -258,7 +258,6 @@ representation will be parsed correctly." (defvar json-special-chars '((?\" . ?\") (?\\ . ?\\) - (?/ . ?/) (?b . ?\b) (?f . ?\f) (?n . ?\n) @@ -313,8 +312,9 @@ representation will be parsed correctly." (let ((l (length string)) (start 0) res mb) - ;; Skip over ASCIIish printable characters. - (while (setq mb (string-match "[\"\\/\b\f\n\r\t]\\|[^ -~]" string start)) + ;; Only escape quotation mark, backslash and the control + ;; characters U+0000 to U+001F (RFC 4627, ECMA-404). + (while (setq mb (string-match "[\"\\[:cntrl:]]" string start)) (let* ((c (aref string mb)) (special (rassq c json-special-chars))) (push (substring string start mb) res) |