-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Surrogate pair #11
Comments
This "bug" is at ((len rdx)
(let ((code
(let ((repr (make-string len)))
(dotimes (i len)
(setf (aref repr i) (read-char stream)))
(handler-case (parse-integer repr :radix rdx)
(parse-error ()
(json-syntax-error stream esc-error-fmt
(format nil "\\~C" c)
repr))))))
(restart-case
(or (and (< code char-code-limit) (code-char code))
(error 'no-char-for-code :code code)) Escape sequence "\u" is just split and encoded in separate characters and then returned. Surrogate pair is just not implemented in CL-JSON. I've got a dirty hack: (progn
(setf xxx (with-input-from-string (stream "\"\\uD83D\\uDE03\"")
(cl-json:decode-json stream)))
(princ (code-char
(let ((c1 (char-code (aref xxx 0)))
(c2 (char-code (aref xxx 1))))
(+ #x10000
(ash (logand #x03FF c1) 10)
(logand #x03FF c2))))))
=>
😃
#\SMILING_FACE_WITH_OPEN_MOUTH |
This also causes a rather nasty failure to handle output:
I suggest using YASON instead. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: