diff options
author | Dmitry Gutov <dgutov@yandex.ru> | 2017-05-10 03:34:16 +0300 |
---|---|---|
committer | Dmitry Gutov <dgutov@yandex.ru> | 2017-05-10 03:34:58 +0300 |
commit | 17e540aa428c5392f7a9b4c1f7495bac8a8fe5da (patch) | |
tree | d720eb99d0b8907f4567dd9c72151dcfa1331b64 /lisp | |
parent | 58326f0f117b229b690023d3851a00d876a7aca6 (diff) | |
download | emacs-17e540aa428c5392f7a9b4c1f7495bac8a8fe5da.tar.gz |
Simplify url-encode-url and add a test
* lisp/url/url-util.el (url-encode-url): Simplify.
url-generic-parse-url copes with multibyte strings just fine
(https://debbugs.gnu.org/cgi/bugreport.cgi?bug=24117#185).
* test/lisp/url/url-parse-tests.el
(url-generic-parse-url/multibyte-host-and-path): New test.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/url/url-util.el | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el index 46d2d8ce5ff..9897dea9c7f 100644 --- a/lisp/url/url-util.el +++ b/lisp/url/url-util.el @@ -450,13 +450,10 @@ This function also performs URI normalization, e.g. converting the scheme to lowercase if it is uppercase. Apart from normalization, if URL is already URI-encoded, this function should return it unchanged." - (if (multibyte-string-p url) - (setq url (encode-coding-string url 'utf-8))) (let* ((obj (url-generic-parse-url url)) (user (url-user obj)) (pass (url-password obj)) - (host (url-host obj)) - (path-and-query (url-path-and-query obj)) + (path-and-query (url-path-and-query obj)) (path (car path-and-query)) (query (cdr path-and-query)) (frag (url-target obj))) @@ -464,12 +461,6 @@ should return it unchanged." (setf (url-user obj) (url-hexify-string user))) (if pass (setf (url-password obj) (url-hexify-string pass))) - ;; No special encoding for IPv6 literals. - (and host - (not (string-match "\\`\\[.*\\]\\'" host)) - (setf (url-host obj) - (decode-coding-string (url-host obj) 'utf-8))) - (if path (setq path (url-hexify-string path url-path-allowed-chars))) (if query |