1 ;; -*- coding: utf-8-mcs-er -*-
2 (require 'char-db-util)
4 (setq file-name-coding-system 'utf-8-mcs-er)
7 (concord-assign-genre 'creator@ruimoku "/usr/local/var/ruimoku/db")
8 (concord-assign-genre 'person-name@ruimoku "/usr/local/var/ruimoku/db")
10 (concord-assign-genre 'journal-volume@ruimoku "/usr/local/var/ruimoku/db")
11 (concord-assign-genre 'article@ruimoku "/usr/local/var/ruimoku/db")
12 (concord-assign-genre 'book@ruimoku "/usr/local/var/ruimoku/db")
14 (concord-assign-genre 'classification@ruimoku "/usr/local/var/ruimoku/db")
15 (concord-assign-genre 'region@ruimoku "/usr/local/var/ruimoku/db")
16 (concord-assign-genre 'era@ruimoku "/usr/local/var/ruimoku/db")
17 (concord-assign-genre 'period@ruimoku "/usr/local/var/ruimoku/db")
18 (concord-assign-genre 'journal@ruimoku "/usr/local/var/ruimoku/db")
21 (defvar chise-wiki-view-url "view.cgi")
22 (defvar chise-wiki-edit-url "edit.cgi")
24 (defvar chise-wiki-bitmap-glyphs-url
25 "http://chise.zinbun.kyoto-u.ac.jp/glyphs")
27 (defvar chise-wiki-glyph-cgi-url
28 "http://chise.zinbun.kyoto-u.ac.jp/chisewiki/glyph.cgi")
30 (defvar chise-wiki-displayed-features nil)
32 (defun decode-uri-string (string &optional coding-system)
33 (if (> (length string) 0)
37 (mapconcat (lambda (char)
40 (char-to-string char)))
42 (while (string-match "%\\([0-9A-F][0-9A-F]\\)" string i)
43 (setq dest (concat dest
44 (substring string i (match-beginning 0))
47 (string-to-int (match-string 1 string) 16))))
50 (concat dest (substring string i))
53 (defun www-feature-type (feature-name)
54 (or (char-feature-property feature-name 'type)
55 (let ((str (symbol-name feature-name)))
57 ((string-match "\\*note\\(@[^*]+\\)?$" str)
59 ((string-match "\\*sources\\(@[^*]+\\)?$" str)
61 ((string-match "\\*" str)
63 ((string-match "^\\(->\\|<-\\)" str)
65 ((string-match "^ideographic-structure\\(@\\|$\\)" str)
69 (defun www-feature-format (feature-name)
70 (or (char-feature-property feature-name 'format)
72 (setq fn feature-name)
73 (while (and (setq parent (char-feature-name-parent fn))
75 (char-feature-property
79 '((name) " : " (value))))
81 (defun www-feature-value-format (feature-name)
82 (or (char-feature-property feature-name 'value-format)
84 (setq fn feature-name)
85 (while (and (setq parent (char-feature-name-parent fn))
87 (char-feature-property
88 parent 'value-format))))
91 (let ((type (www-feature-type feature-name)))
92 (cond ((eq type 'relation)
93 'space-separated-char-list)
99 (if (find-charset feature-name)
100 (if (and (= (charset-dimension feature-name) 2)
101 (= (charset-chars feature-name) 94))
103 " (" (decimal) ") <" (ku-ten) "> " (prev-char) (next-char))
104 '("0x" (HEX) " (" (decimal) ") " (prev-char) (next-char))))))
106 (defun char-feature-name-at-domain (feature-name domain)
108 (let ((name (symbol-name feature-name)))
110 ((string-match "@[^*]+$" name)
111 (intern (format "%s/%s" name domain))
114 (intern (format "%s@%s" name domain))
118 (defun char-feature-name-parent (feature-name)
119 (let ((name (symbol-name feature-name)))
120 (if (string-match "@[^@/*]+\\(/[^@/*]+\\)*$" name)
121 (intern (substring name 0 (car (last (match-data) 2)))))))
123 (defun char-feature-name-domain (feature-name)
124 (let ((name (symbol-name feature-name)))
125 (if (string-match "@[^@/*]+\\(/[^@/*]+\\)*$" name)
126 (intern (substring name (1+ (match-beginning 0)))))))
128 (defun char-feature-name-sans-versions (feature)
129 (let ((feature-name (symbol-name feature)))
130 (if (string-match "[@/]\\$rev=latest$" feature-name)
131 (intern (substring feature-name 0 (match-beginning 0)))
134 (defun est-object-genre (object)
135 (if (characterp object)
137 (concord-object-genre object)))
139 (defun www-get-feature-value (object feature)
140 (let ((latest-feature (char-feature-name-at-domain feature '$rev=latest)))
143 (mount-char-attribute-table latest-feature)
144 (or (char-feature object latest-feature)
145 (char-feature object feature))
148 (or (condition-case nil
149 (concord-object-get object latest-feature)
152 (concord-object-get object feature)
156 (defun get-previous-code-point (ccs code)
157 (let ((chars (charset-chars ccs))
158 (dim (charset-dimension ccs))
160 mask byte-min byte-max
183 (setq bytes (make-vector dim 0))
185 (aset bytes i (logand (lsh code (* i -8)) mask))
188 (while (and (< i dim)
190 (aset bytes i (1- (aref bytes i)))
191 (< (aref bytes i) byte-min)))
192 (aset bytes i byte-max)
195 (setq dest (aref bytes 0)
198 (setq dest (logior dest (lsh (aref bytes i) (* i 8)))
202 (defun get-next-code-point (ccs code)
203 (let ((chars (charset-chars ccs))
204 (dim (charset-dimension ccs))
206 mask byte-min byte-max
229 (setq bytes (make-vector dim 0))
231 (aset bytes i (logand (lsh code (* i -8)) mask))
234 (while (and (< i dim)
236 (aset bytes i (1+ (aref bytes i)))
237 (> (aref bytes i) byte-max)))
238 (aset bytes i byte-min)
241 (setq dest (aref bytes 0)
244 (setq dest (logior dest (lsh (aref bytes i) (* i 8)))
248 (defun find-previous-defined-code-point (ccs code)
249 (let ((i (get-previous-code-point ccs code))
252 ((eq ccs '=jis-x0208)
253 (setq ccs '=jis-x0208@1990))
254 ((eq ccs '=jis-x0213-1)
255 (setq ccs '=jis-x0213-1@2004)))
258 (null (setq char (decode-char ccs i
259 (unless (eq ccs '=ucs)
261 (setq i (get-previous-code-point ccs i)))
264 (defun find-next-defined-code-point (ccs code)
265 (let ((i (get-next-code-point ccs code))
267 (setq max (+ code 1000))
269 ((eq ccs '=jis-x0208)
270 (setq ccs '=jis-x0208@1990))
271 ((eq ccs '=jis-x0213-1)
272 (setq ccs '=jis-x0213-1@2004)))
275 (null (setq char (decode-char ccs i
276 (unless (eq ccs '=ucs)
278 (setq i (get-next-code-point ccs i)))
282 ;;; @ URI representation
285 (defun www-uri-decode-feature-name (uri-feature)
288 ((string-match "^from\\." uri-feature)
289 (intern (format "<-%s" (substring uri-feature (match-end 0))))
291 ((string-match "^to\\." uri-feature)
292 (intern (format "->%s" (substring uri-feature (match-end 0))))
294 ((string-match "^rep\\." uri-feature)
295 (intern (format "=%s" (substring uri-feature (match-end 0))))
297 ((string-match "^g\\." uri-feature)
298 (intern (format "=>>%s" (substring uri-feature (match-end 0))))
300 ((string-match "^gi\\." uri-feature)
301 (intern (format "=>>>%s" (substring uri-feature (match-end 0))))
303 ((string-match "^gi\\([0-9]+\\)\\." uri-feature)
304 (intern (format "=>>%s%s"
305 (make-string (string-to-int
306 (match-string 1 uri-feature))
308 (substring uri-feature (match-end 0))))
310 ((string-match "^a\\." uri-feature)
311 (intern (format "=>%s" (substring uri-feature (match-end 0))))
313 ((string-match "^a\\([0-9]+\\)\\." uri-feature)
314 (intern (format "%s>%s"
315 (make-string (string-to-int
316 (match-string 1 uri-feature))
318 (substring uri-feature (match-end 0))))
320 ((and (setq feature (intern (format "=>%s" uri-feature)))
321 (find-charset feature))
323 ((and (setq feature (intern (format "=>>%s" uri-feature)))
324 (find-charset feature))
326 ((and (setq feature (intern (format "=>>>%s" uri-feature)))
327 (find-charset feature))
329 ((and (setq feature (intern (format "=%s" uri-feature)))
330 (find-charset feature))
332 (t (intern uri-feature)))))
334 (defun www-uri-encode-feature-name (feature-name)
335 (setq feature-name (symbol-name feature-name))
337 ((string-match "^=\\([^=>]+\\)" feature-name)
338 (concat "rep." (substring feature-name (match-beginning 1)))
340 ((string-match "^=>>\\([^=>]+\\)" feature-name)
341 (concat "g." (substring feature-name (match-beginning 1)))
343 ((string-match "^=>>>\\([^=>]+\\)" feature-name)
344 (concat "gi." (substring feature-name (match-beginning 1)))
346 ((string-match "^=>>\\(>+\\)" feature-name)
348 (length (match-string 1 feature-name))
349 (substring feature-name (match-end 1)))
351 ((string-match "^=>\\([^=>]+\\)" feature-name)
352 (concat "a." (substring feature-name (match-beginning 1)))
354 ((string-match "^\\(=+\\)>" feature-name)
356 (length (match-string 1 feature-name))
357 (substring feature-name (match-end 0)))
359 ((string-match "^->" feature-name)
360 (concat "to." (substring feature-name (match-end 0)))
362 ((string-match "^<-" feature-name)
363 (concat "from." (substring feature-name (match-end 0)))
367 (defun www-uri-make-feature-name-url (uri-feature-name uri-char)
368 (format "%s?feature=%s&char=%s"
369 chise-wiki-view-url uri-feature-name uri-char))
371 (defun www-uri-decode-object (genre char-rep)
374 ((string-match "\\(%3A\\|:\\)" char-rep)
375 (setq ccs (substring char-rep 0 (match-beginning 0))
376 cpos (substring char-rep (match-end 0)))
377 (setq ccs (www-uri-decode-feature-name ccs))
379 ((string-match "^0x" cpos)
381 (string-to-number (substring cpos (match-end 0)) 16))
384 (setq cpos (car (read-from-string cpos)))
386 (if (and (eq genre 'character)
388 (decode-char ccs cpos)
389 (concord-decode-object ccs cpos genre))
392 (setq char-rep (decode-uri-string char-rep 'utf-8-mcs-er))
394 ((eq genre 'character)
395 (when (= (length char-rep) 1)
399 (concord-decode-object
400 '=id (www-uri-decode-feature-name char-rep) 'feature)
403 (concord-decode-object
404 '=id (car (read-from-string char-rep)) genre)
407 (defun www-uri-encode-object (object)
408 (if (characterp object)
409 (if (encode-char object '=ucs)
412 (format "%%%02X" byte))
413 (encode-coding-string (char-to-string object) 'utf-8-mcs-er)
415 (let ((ccs-list '(; =ucs
416 =cns11643-1 =cns11643-2 =cns11643-3
417 =cns11643-4 =cns11643-5 =cns11643-6 =cns11643-7
419 =jis-x0208 =jis-x0208@1990
422 =jis-x0213-1@2000 =jis-x0213-1@2004
423 =jis-x0208@1983 =jis-x0208@1978
424 =zinbun-oracle =>zinbun-oracle
427 =>>jis-x0208 =>>jis-x0213-1
428 =>jis-x0208 =>jis-x0213-1
435 (setq ccs (pop ccs-list))
436 (not (setq ret (encode-char object ccs 'defined-only)))))
439 (www-uri-encode-feature-name ccs)
441 ((and (setq ccs (car (split-char object)))
442 (setq ret (encode-char object ccs)))
444 (www-uri-encode-feature-name ccs)
447 (format "system-char-id:0x%X"
448 (encode-char object 'system-char-id))
450 (format "rep.id:%s" (concord-object-id object))))
452 (defun est-format-object (object)
453 (if (characterp object)
454 (char-to-string object)
455 (format "%s" (concord-object-id object))))
458 ;;; @ Feature name presentation
461 (defun www-format-feature-name-default (feature-name)
465 (symbol-name feature-name)
469 (defun www-format-feature-name-as-metadata (feature-name &optional lang)
470 (let ((str (symbol-name feature-name))
473 ((string-match "\\*[^*]+$" str)
474 (setq base (substring str 0 (match-beginning 0))
475 meta (substring str (match-beginning 0)))
476 (concat (www-format-feature-name* (intern base) lang)
479 (www-format-feature-name-default feature-name)
482 (defun www-format-feature-name-as-rel-to (feature-name)
483 (concat "\u2192" (substring (symbol-name feature-name) 2)))
485 (defun www-format-feature-name-as-rel-from (feature-name)
486 (concat "\u2190" (substring (symbol-name feature-name) 2)))
488 (defun www-format-feature-name-as-CCS (feature-name)
491 (symbol-name feature-name)
493 (dest (upcase (pop rest))))
494 (when (string-match "^=+>*" dest)
495 (setq dest (concat (substring dest 0 (match-end 0))
497 (substring dest (match-end 0)))))
501 (setq dest (concat dest " " (upcase (pop rest)))))
502 (if (string-match "^[0-9]+$" (car rest))
503 (concat dest "-" (car rest))
504 (concat dest " " (upcase (car rest))))
508 (defun www-format-feature-name* (feature-name &optional lang)
509 (let (name fn parent ret)
512 (char-feature-property
514 (intern (format "name@%s" lang))))
515 (char-feature-property
516 feature-name 'name)))
517 ((and (setq name (symbol-name feature-name))
518 (string-match "\\*" name))
519 (www-format-feature-name-as-metadata feature-name lang))
521 (setq fn feature-name)
522 (while (and (setq parent (char-feature-name-parent fn))
525 (char-feature-property
527 (intern (format "name@%s" lang))))
528 (char-feature-property
533 (concat ret (substring (symbol-name feature-name)
534 (length (symbol-name parent)))))
535 ((find-charset feature-name)
536 (www-format-feature-name-as-CCS feature-name))
537 ((string-match "^\\(->\\)" name)
538 (www-format-feature-name-as-rel-to feature-name))
539 ((string-match "^\\(<-\\)" name)
540 (www-format-feature-name-as-rel-from feature-name))
542 (www-format-feature-name-default feature-name)
546 (defun www-format-feature-name (feature-name &optional lang)
547 (www-format-encode-string
548 (www-format-feature-name* feature-name lang)))
554 (defun www-format-encode-string (string &optional without-tags)
557 (let (plane code start end char variants ret rret)
558 (goto-char (point-min))
559 (while (search-forward "<" nil t)
560 (replace-match "<" nil t))
561 (goto-char (point-min))
562 (while (search-forward ">" nil t)
563 (replace-match ">" nil t))
565 (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er)
566 (let ((coded-charset-entity-reference-alist
569 '(=cns11643-1 "C1-" 4 X)
570 '(=cns11643-2 "C2-" 4 X)
571 '(=cns11643-3 "C3-" 4 X)
572 '(=cns11643-4 "C4-" 4 X)
573 '(=cns11643-5 "C5-" 4 X)
574 '(=cns11643-6 "C6-" 4 X)
575 '(=cns11643-7 "C7-" 4 X)
577 '(=gb12345 "G1-" 4 X)
578 '(=jis-x0208@1990 "J90-" 4 X)
579 '(=jis-x0212 "JSP-" 4 X)
581 '(=jis-x0208@1997 "J97-" 4 X)
582 '(=jis-x0208@1978 "J78-" 4 X)
583 '(=jis-x0208@1983 "J83-" 4 X)
584 '(=ruimoku-v6 "RUI6-" 4 X)
585 '(=zinbun-oracle "ZOB-" 4 d)
586 '(=jef-china3 "JC3-" 4 X)
587 '(=daikanwa "M-" 5 d)
588 coded-charset-entity-reference-alist)))
589 (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er)
591 (goto-char (point-min))
592 (while (re-search-forward "&CB\\([0-9]+\\);" nil t)
593 (setq code (string-to-int (match-string 1)))
595 (format "<img alt=\"CB%05d\" src=\"%s/cb-gaiji/%02d/CB%05d.gif\">"
597 chise-wiki-bitmap-glyphs-url
601 (goto-char (point-min))
602 (while (re-search-forward "&J\\(78\\|83\\|90\\|97\\|SP\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
603 (setq plane (match-string 1)
604 code (string-to-int (match-string 2) 16))
606 (format "<img alt=\"J%s-%04X\" src=\"%s/JIS-%s/%02d-%02d.gif\">"
608 chise-wiki-bitmap-glyphs-url
611 (- (logand code 255) 32))
614 (goto-char (point-min))
615 (while (re-search-forward "&G\\([01]\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
616 (setq plane (string-to-int (match-string 1))
617 code (string-to-int (match-string 2) 16))
619 (format "<img alt=\"GB%d-%04X\" src=\"%s/GB%d/%02d-%02d.gif\">"
621 chise-wiki-bitmap-glyphs-url
624 (- (logand code 255) 32))
627 (goto-char (point-min))
628 (while (re-search-forward "&C\\([1-7]\\)-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
629 (setq plane (string-to-int (match-string 1))
630 code (string-to-int (match-string 2) 16))
632 (format "<img alt=\"CNS%d-%04X\" src=\"%s/CNS%d/%04X.gif\">"
634 chise-wiki-bitmap-glyphs-url
638 (goto-char (point-min))
639 (while (re-search-forward "&JC3-\\([0-9A-F][0-9A-F][0-9A-F][0-9A-F]\\);" nil t)
640 (setq code (string-to-int (match-string 1) 16))
642 (format "<img alt=\"JC3-%04X\" src=\"http://kanji.zinbun.kyoto-u.ac.jp/db/CHINA3/Gaiji/%04x.gif\">"
646 (goto-char (point-min))
647 (while (re-search-forward "&\\(A-\\)?ZOB-\\([0-9]+\\);" nil t)
648 (setq code (string-to-int (match-string 2)))
650 (format "<img alt=\"ZOB-%04d\" src=\"%s/ZOB-1968/%04d.png\">"
652 chise-wiki-bitmap-glyphs-url
656 (goto-char (point-min))
657 (while (re-search-forward "&\\(G-\\)?GT-\\([0-9]+\\);" nil t)
658 (setq code (string-to-int (match-string 2)))
660 (format "<img alt=\"GT-%05d\" src=\"%s?char=GT-%05d\">"
662 chise-wiki-glyph-cgi-url
666 (goto-char (point-min))
667 (while (re-search-forward "&\\(G-\\)?GT-K\\([0-9]+\\);" nil t)
668 (setq code (string-to-int (match-string 2)))
670 (format "<img alt=\"GT-K%05d\" src=\"%s?char=GT-K%05d\">"
672 chise-wiki-glyph-cgi-url
676 (goto-char (point-min))
677 (while (re-search-forward "&B-\\([0-9A-F]+\\);" nil t)
678 (setq code (string-to-int (match-string 1) 16))
680 (format "<img alt=\"B-%04X\" src=\"%s?char=B-%04X\">"
682 chise-wiki-glyph-cgi-url
686 (goto-char (point-min))
687 (while (re-search-forward "&CDP-\\([0-9A-F]+\\);" nil t)
688 (setq code (string-to-int (match-string 1) 16))
690 (format "<img alt=\"CDP-%04X\" src=\"%s?char=CDP-%04X\">"
692 chise-wiki-glyph-cgi-url
696 (goto-char (point-min))
697 (while (re-search-forward "&RUI6-\\([0-9A-F]+\\);" nil t)
698 (setq code (string-to-int (match-string 1) 16))
700 (format "<img alt=\"RUI6-%04X\" src=\"%s?char=RUI6-%04X\">"
702 chise-wiki-glyph-cgi-url
706 (goto-char (point-min))
707 (while (re-search-forward "&\\(UU\\+\\|U-\\)\\([0-9A-F]+\\);" nil t)
708 (setq code (string-to-int (match-string 2) 16))
710 (format "<img alt=\"UU+%04X\" src=\"http://www.unicode.org/cgi-bin/refglyph?24-%04X\">"
715 (goto-char (point-min))
716 (while (re-search-forward "&MCS-\\([0-9A-F]+\\);" nil t)
717 (setq code (string-to-int (match-string 1) 16))
718 (setq start (match-beginning 0)
720 (setq char (decode-char 'system-char-id code))
723 (or (www-get-feature-value char '->subsumptive)
724 (www-get-feature-value char '->denotational)))
727 (setq ret (www-format-encode-string
728 (char-to-string (car variants))))
729 (string-match "&MCS-\\([0-9A-F]+\\);" ret))
730 (setq variants (cdr variants)))
732 (unless (string-match "&MCS-\\([0-9A-F]+\\);" ret)
734 (delete-region start end)
737 ((setq ret (or (www-get-feature-value char 'ideographic-combination)
738 (www-get-feature-value char 'ideographic-structure)))
743 (if (characterp (setq rret (find-char ch)))
746 (www-format-encode-string
747 (char-to-string ch) without-tags)
748 (www-format-encode-string
749 (format "%S" ch) without-tags)))
753 (delete-region start end)
757 ;; (goto-char (point-min))
758 ;; (while (search-forward ">-" nil t)
759 ;; (replace-match "&GT-" t 'literal))
762 (defun www-html-display-text (text)
766 (goto-char (point-min))
767 (while (search-forward "<" nil t)
768 (replace-match "<" nil t))
769 (goto-char (point-min))
770 (while (search-forward ">" nil t)
771 (replace-match ">" nil t))
772 (goto-char (point-min))
773 (while (re-search-forward "\\[\\[\\([^]|[]+\\)|\\([^][]+\\)\\]\\]" nil t)
775 (format "<a href=\"%s\">%s</a>"
779 (encode-coding-region (point-min)(point-max) 'utf-8-mcs-er)
780 (goto-char (point-min))
781 (while (search-forward ">-" nil t)
782 (replace-match "&GT-" nil t))
785 (defun www-html-display-paragraph (text)
787 (www-html-display-text text)
794 (defvar coded-charset-GlyphWiki-id-alist
796 (=ucs@JP "u" 4 x nil)
797 (=ucs@jis "u" 4 x nil)
798 (=ucs@gb "u" 4 x "-g")
799 (=ucs@cns "u" 4 x "-t")
800 (=ucs@ks "u" 4 x "-k")
801 (=ucs@iso "u" 4 x "-u")
802 (=ucs@unicode "u" 4 x "-us")
803 (=adobe-japan1-6 "aj1-" 5 d nil)
805 (=big5-cdp "cdp-" 4 x nil)
806 (=cbeta "cb" 5 d nil)
807 (=jis-x0208@1978/1pr "j78-" 4 x nil)
808 (=jis-x0208@1978/-4pr "j78-" 4 x nil)
809 (=jis-x0208@1978 "j78-" 4 x nil)
810 (=jis-x0208@1983 "j83-" 4 x nil)
811 (=jis-x0208@1990 "j90-" 4 x nil)
812 (=jis-x0212 "jsp-" 4 x nil)
813 (=jis-x0213-1@2000 "jx1-2000-" 4 x nil)
814 (=jis-x0213-1@2004 "jx1-2004-" 4 x nil)
815 (=jis-x0213-2 "jx2-" 4 x nil)
816 (=cns11643-1 "c1-" 4 x nil)
817 (=cns11643-2 "c2-" 4 x nil)
818 (=cns11643-3 "c3-" 4 x nil)
819 (=cns11643-4 "c4-" 4 x nil)
820 (=cns11643-5 "c5-" 4 x nil)
821 (=cns11643-6 "c6-" 4 x nil)
822 (=cns11643-7 "c7-" 4 x nil)
823 (=daikanwa "dkw-" 5 d nil)
824 (=gt-k "gt-k" 5 d nil)
825 (=jef-china3 "jc3-" 4 x nil)
827 (=ks-x1001 "k0-" 4 x nil)
830 (defun char-GlyphWiki-id (char)
831 (let ((rest coded-charset-GlyphWiki-id-alist)
834 (setq spec (pop rest))
835 (null (setq ret (char-feature char (car spec))))))
838 (and (memq (car spec) '(=ucs@unicode '=ucs@iso))
840 ((and (or (encode-char char '=jis-x0208@1990)
841 (encode-char char '=jis-x0212)
842 (encode-char char '=jis-x0213-1))
843 (setq code (encode-char char '=ucs@jis)))
844 (format "u%04x" code)
846 ((and (or (encode-char char '=gb2312)
847 (encode-char char '=gb12345))
848 (setq code (encode-char char '=ucs@gb)))
849 (format "u%04x-g" code)
851 ((and (or (encode-char char '=cns11643-1)
852 (encode-char char '=cns11643-2)
853 (encode-char char '=cns11643-3)
854 (encode-char char '=cns11643-4)
855 (encode-char char '=cns11643-5)
856 (encode-char char '=cns11643-6)
857 (encode-char char '=cns11643-7))
858 (setq code (encode-char char '=ucs@cns)))
859 (format "u%04x-t" code)
861 ((and (encode-char char '=ks-x1001)
862 (setq code (encode-char char '=ucs@ks)))
863 (format "u%04x-k" code)
865 (format (format "%s%%0%d%s%s"
869 (or (nth 4 spec) ""))
876 (provide 'cwiki-common)
878 ;;; cwiki-common.el ends here