[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Suggestion: (url-retrieve-internal) hexify multibyte URL string first
From: |
William Xu |
Subject: |
Suggestion: (url-retrieve-internal) hexify multibyte URL string first |
Date: |
Thu, 01 Jul 2010 02:31:05 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2.50 (darwin) |
Currently, url-retrieve call doesn't take care of multibyte string URL
at all. Hence, the following example would simply fail:
;; url containing some Chinese characters here
(url-retrieve
"http://a1.twimg.com/profile_images/65068764/我的头像_normal.png"
(lambda (&rest args) (switch-to-buffer (current-buffer))))
Feeding the same url to `wget', it would first hexify it, then download
it successfully. I suggest we do the same in url-retrieve, like this:
(url-retrieve-internal): Hexify multibye URL string first when necessary.
diff --git a/lisp/url/url.el b/lisp/url/url.el
index 6f7b810..15445ef 100644
--- a/lisp/url/url.el
+++ b/lisp/url/url.el
@@ -164,6 +164,9 @@ the list of events, as described in the docstring of
`url-retrieve'."
(url-gc-dead-buffers)
(if (stringp url)
(set-text-properties 0 (length url) nil url))
+ (when (multibyte-string-p url)
+ (let ((url-unreserved-chars (append '(?: ?/) url-unreserved-chars)))
+ (setq url (url-hexify-string url))))
(if (not (vectorp url))
(setq url (url-generic-parse-url url)))
(if (not (functionp callback))
--
William
http://xwl.appspot.com
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Suggestion: (url-retrieve-internal) hexify multibyte URL string first,
William Xu <=