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-batch-ids-find ()
22 (let ((components (car command-line-args-left))
24 (setq command-line-args-left (cdr command-line-args-left))
27 (if (string-match "^components=" components)
28 (setq components (substring components (match-end 0))))
30 (if (> (length components) 0)
31 (decode-url-string components 'utf-8-jp-er)
37 (princ "Content-Type: text/html; charset=\"UTF-8\"
39 <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"
40 \"http://www.w3.org/TR/html4/loose.dtd\">
43 <title>CHISE IDS Find</title>
49 (princ (encode-coding-string "CHISE IDS
\e$B4A;z8!:w
\e(B" 'utf-8-jp-er))
52 <form action=\"http://mousai.kanji.zinbun.kyoto-u.ac.jp/ids-find\" method=\"GET\">
54 (princ (encode-coding-string "
\e$BItIJJ8;zNs
\e(B" 'utf-8-jp-er))
55 (princ " <input type=\"text\" name=\"components\" size=\"30\" maxlength=\"30\" value=\"")
56 (if (> (length components) 0)
57 (princ (encode-coding-string components 'utf-8-er)))
59 <input type=\"submit\" value=\"")
60 (princ (encode-coding-string "
\e$B8!:w3+;O
\e(B" 'utf-8-jp-er))
66 ;; (map-char-attribute
68 ;; (when (every (lambda (p)
69 ;; (ideographic-structure-member p v))
71 ;; (princ (encode-coding-string
72 ;; (ids-find-format-line c v)
77 ;; 'ideographic-structure)
78 (dolist (c (ideographic-products-find components))
79 (setq is (char-feature c 'ideographic-structure))
80 ;; to avoid problems caused by wrong indexes
81 (when (every (lambda (c)
82 (ideographic-structure-member c is))
89 (or (if (setq ucs (or (char-ucs c)
90 (encode-char c 'ucs)))
91 (format " <a href=\"http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=%X\">%s</a>"
93 (cond ((<= ucs #xFFFF)
94 (format "U+%04X" ucs))
96 (format "U-%08X" ucs))))
100 (encode-coding-string
101 (ideographic-structure-to-ids is)
106 www-ids-find-tang-chars-file-name)
107 (goto-char (point-min))
108 (re-search-forward (format "^%d$" ucs) nil t)))
110 (format " <a href=\"http://coe21.zinbun.kyoto-u.ac.jp/djvuchar?query=%s\">"
113 (format "%%%02X" (char-int c)))
114 (encode-coding-string (char-to-string c)
117 (princ (encode-coding-string "
\e$B"M
\e(B[
\e$BEbBeBsK\
\e(B]</a>" 'utf-8-jp-er)))