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 (defun www-batch-ids-find ()
19 (let ((components (car command-line-args-left))
21 (setq command-line-args-left (cdr command-line-args-left))
24 (if (string-match "^components=" components)
25 (setq components (substring components (match-end 0))))
27 (if (> (length components) 0)
28 (decode-url-string components 'utf-8-jp-er)
34 (princ "Content-Type: text/html; charset=\"UTF-8\"
36 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
37 \"http://www.w3.org/TR/html4/loose.dtd\">
40 <title>CHISE IDS Find</title>
46 (princ (encode-coding-string "CHISE IDS
\e$B4A;z8!:w
\e(B" 'utf-8-jp-er))
49 <form action=\"http://mousai.kanji.zinbun.kyoto-u.ac.jp/ids-find\" method=\"GET\">
51 (princ (encode-coding-string "
\e$BItIJJ8;zNs
\e(B" 'utf-8-jp-er))
52 (princ " <input type=\"text\" name=\"components\" size=\"30\" maxlength=\"30\" value=\"")
53 (if (> (length components) 0)
54 (princ (encode-coding-string components 'utf-8-er)))
56 <input type=\"submit\" value=\"")
57 (princ (encode-coding-string "
\e$B8!:w3+;O
\e(B" 'utf-8-jp-er))
63 ;; (map-char-attribute
65 ;; (when (every (lambda (p)
66 ;; (ideographic-structure-member p v))
68 ;; (princ (encode-coding-string
69 ;; (ids-find-format-line c v)
74 ;; 'ideographic-structure)
75 (dolist (c (ideographic-products-find components))
76 (setq is (char-feature c 'ideographic-structure))
77 ;; to avoid problems caused by wrong indexes
78 (when (every (lambda (c)
79 (ideographic-structure-member c is))
86 (or (if (setq ucs (or (char-ucs c)
87 (encode-char c 'ucs)))
88 (format "<a href=\"http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=%X\">%s</a>"
90 (cond ((<= ucs #xFFFF)
91 (format " U+%04X" ucs))
93 (format "U-%08X" ucs))))
98 (ideographic-structure-to-ids is)
103 "~tomo/projects/chise/ids/www/tang-chars.udd")
104 (goto-char (point-min))
105 (re-search-forward (format "^%d$" ucs) nil t)))
107 (format " <a href=\"http://coe21.zinbun.kyoto-u.ac.jp/djvuchar?query=%s\">"
110 (format "%%%02X" (char-int c)))
111 (encode-coding-string (char-to-string c)
114 (princ (encode-coding-string "
\e$B"M
\e(B[
\e$BEbBeBsK\
\e(B]</a>" 'utf-8-jp-er)))