changeset 82100:a26a0d557a69

(webjump-url-encode): Fix for non-ASCII characters.
author Kenichi Handa <handa@m17n.org>
date Wed, 25 Jul 2007 00:54:25 +0000
parents d8afe3f9ddb7
children 2b59748c35cf
files lisp/net/webjump.el
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/net/webjump.el	Tue Jul 24 23:05:44 2007 +0000
+++ b/lisp/net/webjump.el	Wed Jul 25 00:54:25 2007 +0000
@@ -451,14 +451,12 @@
 
 (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)