GNU bug report logs -
#7017
Suggestion: (url-retrieve-internal) hexify multibyte URL string first
Previous Next
Reported by: William Xu <william.xwl <at> gmail.com>
Date: Sun, 12 Sep 2010 01:03:02 UTC
Severity: normal
Tags: fixed, patch
Done: Chong Yidong <cyd <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #1 received at quiet <at> debbugs.gnu.org (full text, mbox):
Package: emacs
[ resent from emacs-devel ]
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
This bug report was last modified 13 years and 96 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.