* webjump-url-encode and non-ascii characters
@ 2007-07-04 10:34 William Xu
0 siblings, 0 replies; only message in thread
From: William Xu @ 2007-07-04 10:34 UTC (permalink / raw)
To: emacs-devel
webjump-url-encode fails to encode non-ascii characters correctly.
Here's a patch:
--- webjump.el 2007-06-03 14:54:53.000000000 +0800
+++ webjump.el.new 2007-07-04 18:29:41.000000000 +0800
@@ -451,14 +451,13 @@
(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))))))
+ (string-to-list
+ (encode-coding-string str buffer-file-coding-system))
+ ""))
(defun webjump-url-fix (url)
(if (webjump-null-or-blank-string-p url)
--
William
《出塞》
作者:王之涣
黄河远上白云间,一片孤城万仞山。
羌笛何须怨杨柳,春风不度玉门关。
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-07-04 10:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-04 10:34 webjump-url-encode and non-ascii characters William Xu
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.