]> code.delx.au - gnu-emacs/commitdiff
(webjump-url-encode): Fix for non-ASCII characters.
authorKenichi Handa <handa@m17n.org>
Wed, 25 Jul 2007 00:54:44 +0000 (00:54 +0000)
committerKenichi Handa <handa@m17n.org>
Wed, 25 Jul 2007 00:54:44 +0000 (00:54 +0000)
lisp/ChangeLog
lisp/net/webjump.el

index e30db6c7029c0172ba7c55510089ead37b445f90..15732e651c691751dc4e37d9a68c5ac971bd046a 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-25  William Xu  <william.xwl@gmail.com>  (tiny change)
+
+       * net/webjump.el (webjump-url-encode): Fix for non-ASCII
+       characters.
+
 2007-07-24  Dan Nicolaescu  <dann@ics.uci.edu>
 
        * dired.el (dired-mode-map): Bind wdired-change-to-wdired-mode to
index 03ce630519687b095ed1b5653c5bfe14beefb995..0b04c8f2f4060f6a17dcde517cf504b4932cea1f 100644 (file)
@@ -451,14 +451,12 @@ Please submit bug reports and other feedback to the author, Neil W. Van Dyke
 
 (defun webjump-url-encode (str)
   (mapconcat '(lambda (c)
-               (cond ((= c 32) "+")
-                     ((or (and (>= c ?a) (<= c ?z))
-                          (and (>= c ?A) (<= c ?Z))
-                          (and (>= c ?0) (<= c ?9)))
-                      (char-to-string c))
-                     (t (upcase (format "%%%02x" c)))))
-            str
-            ""))
+                (let ((s (char-to-string c)))
+                  (cond ((string= s " ") "+")
+                        ((string-match "[a-zA-Z_.-/]" s) s)
+                        (t (upcase (format "%%%02x" c))))))
+             (encode-coding-string str 'utf-8)
+             ""))
 
 (defun webjump-url-fix (url)
   (if (webjump-null-or-blank-string-p url)