[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
webjump-url-encode and non-ascii characters
From: |
William Xu |
Subject: |
webjump-url-encode and non-ascii characters |
Date: |
Wed, 04 Jul 2007 18:34:51 +0800 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) |
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
《出塞》
作者:王之涣
黄河远上白云间,一片孤城万仞山。
羌笛何须怨杨柳,春风不度玉门关。
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- webjump-url-encode and non-ascii characters,
William Xu <=