(www-parse-string-as-space-separated-char-list): Expect `string' not
authorMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Wed, 17 Mar 2010 19:36:35 +0000 (04:36 +0900)
committerMORIOKA Tomohiko <tomo@kanji.zinbun.kyoto-u.ac.jp>
Wed, 17 Mar 2010 19:36:35 +0000 (04:36 +0900)
to be decoded by `decode-uri-string'.
(www-parse-string-as-space-separated-ids): Likewise.
(www-feature-parse-string): Likewise.
(www-set-display-char-desc): Expect `uri-char' not to be decoded by
`decode-uri-string'.
(www-set-display-feature-desc): Fix problem when `name@lang' is not
existed.
(www-batch-set): Don't use `decode-uri-string' for value of `char' and
feature-value.

cwiki-set.el

index 0a92436..9950fd2 100644 (file)
@@ -8,21 +8,22 @@
 
 (defun www-parse-string-as-space-separated-char-list (string)
   (let (dest char)
-    (dolist (unit (split-string string " "))
+    (dolist (unit (split-string string "\\+"))
       (if (setq char (www-uri-decode-char unit))
          (setq dest (cons char dest))))
     (nreverse dest)))
 
 (defun www-parse-string-as-space-separated-ids (string)
-  (ids-parse-string
-   (let (char)
-     (mapconcat
-      (lambda (unit)
-       (if (setq char (www-uri-decode-char unit))
-           (char-to-string char)
-         unit))
-      (split-string string " ")
-      ""))))
+  (cdar
+   (ids-parse-string
+    (let (char)
+      (mapconcat
+       (lambda (unit)
+        (if (setq char (www-uri-decode-char unit))
+            (char-to-string char)
+          unit))
+       (split-string string "\\+")
+       "")))))
 
 (defun www-parse-string-as-ku-ten (string)
   (if (string-match "^\\([0-9][0-9]?\\)-\\([0-9][0-9]?\\)" string)
@@ -49,8 +50,9 @@
        ((eq format 'S-exp)
         (if (= (length string) 0)
             nil
-          (read string)))
-       (t string)))
+          (read (decode-uri-string string 'utf-8-mcs-er)))
+        )
+       (t (decode-uri-string string 'utf-8-mcs-er))))
 
 (defun www-set-display-char-desc (uri-char feature value format &optional lang)
   (when (stringp feature)
@@ -64,7 +66,7 @@
        (format "<head>
 <title>CHISE-wiki character: %s</title>
 </head>\n"
-               uri-char)
+               (decode-uri-string uri-char 'utf-8-mcs-er))
        'utf-8-mcs-er))
       (princ "<body>\n")
       (www-html-display-paragraph
 (defun www-set-display-feature-desc (feature-name property-name value
                                                  &optional lang uri-char)
   (www-html-display-paragraph
-   (format "set: feature: %S, property-name: %S, value: %S, lang: %S\n"
-          feature-name property-name value lang))
+   (format
+    "set: feature: %S, property-name: %S, value: %S, lang: %S, char: %S\n"
+    feature-name property-name value lang uri-char))
   (put-char-feature-property feature-name property-name value)
   (let ((name@lang (intern (format "name@%s" lang)))
        (uri-feature-name (www-uri-encode-feature-name feature-name)))
 ><input type=\"submit\" value=\"edit\" /></a></p>
 "
               name@lang
-              (or (www-format-encode-string
-                   (char-feature-property feature-name name@lang)) "")
+              (www-format-encode-string
+               (or (char-feature-property feature-name name@lang) ""))
               chise-wiki-edit-url
               uri-feature-name
               name@lang)))
        (cond ((eq (car ret) 'char)
               (setq prop (nth 2 target))
               (www-set-display-char-desc
-               (decode-uri-string (cdr ret) 'utf-8-mcs-er)
-               (cdr (assq 'feature-name target))
-               (decode-uri-string (cdr prop) 'utf-8-mcs-er)
+               (cdr ret) ; (decode-uri-string (cdr ret) 'utf-8-mcs-er)
+               (intern (decode-uri-string
+                        (cdr (assq 'feature-name target))
+                        'utf-8-mcs-er))
+                (cdr prop) ; (decode-uri-string (cdr prop) 'utf-8-mcs-er)
                (car prop)
                 lang)
               )
                (car prop)
                (decode-uri-string (cdr prop) 'utf-8-mcs-er)
                lang
-               (decode-uri-string (cdr (assq 'char target))))
+                (cdr (assq 'char target))
+               ;; (decode-uri-string (cdr (assq 'char target)))
+               )
               ))
        (www-html-display-paragraph
         (format "%S" target))