Commit 8ae548a8 authored by MORIOKA Tomohiko's avatar MORIOKA Tomohiko
Browse files

(chise-json-encode-ucs-string): New function.

- Sort children-spec.
- Use `chise-json-encode-ucs-string' instead of
- Sort `phonetic-value'.
parent 1edece33
......@@ -60,6 +60,27 @@
string "")))
(defun chise-json-encode-ucs-string (string)
(let (ucs ret)
(mapconcat (lambda (object)
(if (or (setq ucs (encode-char object '=ucs))
(if (and (setq ucs (char-ucs object))
(setq ret (decode-char '=ucs ucs)))
(setq object ret)))
(if (<= ucs #xFFFF)
(char-to-string object)
(setq ret (encode-coding-string (char-to-string object)
(format "\\u%2X%02X\\u%02X%02X"
(aref ret 1)
(aref ret 0)
(aref ret 3)
(aref ret 2)
(encode-coding-string (char-to-string object)
string "")))
(defun json-encode (object)
"Return a JSON representation of OBJECT as a string."
(if (or (characterp object)
......@@ -2242,7 +2263,9 @@
(setq ret (chise-json-other-spec-get-sound other-spec))
(setq sound-spec (car ret)
other-spec (cdr ret))
(dolist (cell children-spec)
(dolist (cell (sort children-spec
(lambda (a b)
(chise-json-normalized-feature< b a))))
(setq dest
(cons (cond
......@@ -2348,7 +2371,7 @@
(cdr (assq 'body (cdr cell))))))
(cons 'ids
(ideographic-structure-to-ids ret)))
(cons 'ideographic-structure ret)
(del-alist 'body (cdr cell))))))
......@@ -2420,7 +2443,9 @@
(if sound-spec
(setq dest
(cons (cons 'phonetic-value sound-spec)
(cons (cons 'phonetic-value (sort sound-spec
(lambda (a b)
(string< (car a)(car b)))))
(if radical-strokes-spec
(setq dest
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment