emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: webjump-url-encode and non-ascii characters]


From: William Xu
Subject: Re: address@hidden: webjump-url-encode and non-ascii characters]
Date: Tue, 24 Jul 2007 21:31:07 +0900
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.0 (gnu/linux)

Kenichi Handa <address@hidden> writes:

> One more note about your change.
>
> As mapconcat accepts a sequence (including string),
> string-to-list is not necessary.

Correct, thanks ! Here's the updated patch.

cvs diff: Diffing .
Index: webjump.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/webjump.el,v
retrieving revision 1.4.6.10
diff -u -r1.4.6.10 webjump.el
--- webjump.el  30 May 2007 14:40:32 -0000      1.4.6.10
+++ webjump.el  24 Jul 2007 12:30:46 -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)

-- 
William

《蜀先主庙》
作者:刘禹锡
天地英雄气,千秋尚凛然。
势分三足鼎,业复五铢钱。
得相能开国,生儿不象贤。
凄凉蜀故妓,来舞魏宫前。





reply via email to

[Prev in Thread] Current Thread [Next in Thread]