3 (defun decode-url-string (string &optional coding-system)
4 (if (> (length string) 0)
7 (while (string-match "%\\([0-9A-F][0-9A-F]\\)" string i)
8 (setq dest (concat dest
9 (substring string i (match-beginning 0))
12 (string-to-int (match-string 1 string) 16))))
15 (concat dest (substring string i))
18 (defvar www-ids-find-tang-chars-file-name
19 "~tomo/projects/chise/ids/www/tang-chars.udd")
21 (defun www-ids-find-format-line (c is)
22 (let ((str (encode-coding-string (format "%c" c) 'utf-8-jp-er))
25 ((string-match "&CB\\([0-9]+\\);" str)
26 (setq code (string-to-int (match-string 1 str)))
27 (princ (format "<img alt=\"CB%05d\" src=\"http://mousai.kanji.zinbun.kyoto-u.ac.jp/glyphs/cb-gaiji/%02d/CB%05d.gif\">\n"
28 code (/ code 1000) code))
29 (princ (format "CB%05d" code))
34 (or (if (setq ucs (or (char-ucs c)
35 (encode-char c 'ucs)))
36 (format " <a href=\"http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=%X\">%s</a>"
38 (cond ((<= ucs #xFFFF)
39 (format "U+%04X" ucs))
41 (format "U-%08X" ucs))))
49 (ideographic-structure-to-ids is)
51 (goto-char (point-min))
52 (while (re-search-forward "&CB\\([0-9]+\\);" nil t)
53 (setq code (string-to-int (match-string 1)))
55 (format "<img alt=\"CB%05d\" src=\"http://mousai.kanji.zinbun.kyoto-u.ac.jp/glyphs/cb-gaiji/%02d/CB%05d.gif\">"
56 code (/ code 1000) code)
62 www-ids-find-tang-chars-file-name)
63 (goto-char (point-min))
64 (re-search-forward (format "^%d$" ucs) nil t)))
66 (format " <a href=\"http://coe21.zinbun.kyoto-u.ac.jp/djvuchar?query=%s\">"
69 (format "%%%02X" (char-int c)))
70 (encode-coding-string (char-to-string c)
73 (princ (encode-coding-string "
\e$B"M
\e(B[
\e$BEbBeBsK\
\e(B]</a>" 'utf-8-jp-er)))
76 (defun www-batch-ids-find ()
77 (let ((components (car command-line-args-left))
78 (coded-charset-entity-reference-alist
81 (=jef-china3 "JC3-" 4 X))
82 coded-charset-entity-reference-alist))
84 (setq command-line-args-left (cdr command-line-args-left))
87 (if (string-match "^components=" components)
88 (setq components (substring components (match-end 0))))
90 (if (> (length components) 0)
91 (decode-url-string components 'utf-8-jp-er)
97 (princ "Content-Type: text/html; charset=\"UTF-8\"
99 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
100 \"http://www.w3.org/TR/html4/loose.dtd\">
103 <title>CHISE IDS Find</title>
109 (princ (encode-coding-string "CHISE IDS
\e$B4A;z8!:w
\e(B" 'utf-8-jp-er))
112 <form action=\"http://mousai.kanji.zinbun.kyoto-u.ac.jp/ids-find\" method=\"GET\">
114 (princ (encode-coding-string "
\e$BItIJJ8;zNs
\e(B" 'utf-8-jp-er))
115 (princ " <input type=\"text\" name=\"components\" size=\"30\" maxlength=\"30\" value=\"")
116 (if (> (length components) 0)
117 (princ (encode-coding-string components 'utf-8-jp-er)))
119 <input type=\"submit\" value=\"")
120 (princ (encode-coding-string "
\e$B8!:w3+;O
\e(B" 'utf-8-jp-er))
127 ;; (map-char-attribute
129 ;; (when (every (lambda (p)
130 ;; (ideographic-structure-member p v))
132 ;; (princ (encode-coding-string
133 ;; (ids-find-format-line c v)
138 ;; 'ideographic-structure)
139 (when (= (length components) 1)
140 (www-ids-find-format-line (aref components 0) nil))
141 (dolist (c (ideographic-products-find components))
142 (setq is (char-feature c 'ideographic-structure))
143 ;; to avoid problems caused by wrong indexes
144 (when (every (lambda (c)
145 (ideographic-structure-member c is))
147 (www-ids-find-format-line c is)))
150 (princ (encode-coding-string "<hr>
152 \e$B;XDj$7$?ItIJ$rA4$F4^$`4A;z$N0lMw$rI=<($7$^$9!#
\e(B
154 CHISE
\e$B$GMQ$$$i$l$k<BBV;2>H7A<0!JNc!'
\e(B&M-00256;
\e$B!K$GItIJ$r;XDj$9$k;v$b$G$-$^$9!#
\e(B" 'utf-8-jp-er))
160 href=\"http://kanji.zinbun.kyoto-u.ac.jp/projects/chise/xemacs/\"
161 >XEmacs CHISE</a> %s."
162 xemacs-chise-version))