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