Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix generation of unicode characters.
  • Loading branch information
Thomas de Grivel committed Jun 19, 2015
1 parent 39d1519 commit 244106a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/codegen.lisp
Expand Up @@ -18,7 +18,12 @@ characters in string S to STREAM."
do (write-char #\\ stream) (write-char ch stream)
else if (setq special (car (rassoc ch +json-lisp-escaped-chars+)))
do (write-char #\\ stream) (write-char special stream)
else do (write-char ch stream))
else if (< #x1f code #x7f)
do (write-char ch stream)
else
do (let ((special '#.(rassoc-if #'consp +json-lisp-escaped-chars+)))
(destructuring-bind (esc . (width . radix)) special
(format stream "\\~C~V,V,'0R" esc radix width code))))
(write-char quote stream))
;;; </cl-json>

Expand Down
1 change: 1 addition & 0 deletions src/constants.lisp
Expand Up @@ -3,6 +3,7 @@
;;; <cl-json> --- the following is taken from cl-json
(defparameter +json-lisp-escaped-chars+
'((#\\ . #\\)
(#\/ . #\/)
(#\b . #\Backspace)
(#\f . #\ )
(#\n . #\Newline)
Expand Down

0 comments on commit 244106a

Please sign in to comment.