summaryrefslogtreecommitdiff
path: root/lisp/url/url-util.el
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2012-04-10 04:14:13 +0200
committerLars Magne Ingebrigtsen <larsi@gnus.org>2012-04-10 04:14:13 +0200
commit4bbc3323df984f9614960a066d99460be4a65b4a (patch)
tree8c6082f64f8e151afb5b480cb5a858f769ad0b9c /lisp/url/url-util.el
parent24d78a88add65761b0d0f63777e76fca6f2d66f8 (diff)
downloademacs-4bbc3323df984f9614960a066d99460be4a65b4a.tar.gz
(url-unhex-string): Add an optional CODING-SYSTEM parameter.
Fixes: debbugs:6252
Diffstat (limited to 'lisp/url/url-util.el')
-rw-r--r--lisp/url/url-util.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index 848eb66e54b..c62b820c2e7 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -308,11 +308,13 @@ Will not do anything if `url-show-status' is nil."
;; str))
;;;###autoload
-(defun url-unhex-string (str &optional allow-newlines)
+(defun url-unhex-string (str &optional allow-newlines coding-system)
"Remove %XX embedded spaces, etc in a URL.
If optional second argument ALLOW-NEWLINES is non-nil, then allow the
decoding of carriage returns and line feeds in the string, which is normally
-forbidden in URL encoding."
+forbidden in URL encoding.
+If CODING-SYSTEM is non-nil, interpret the unhexed string as
+being encoded in that coding system."
(setq str (or str ""))
(let ((tmp "")
(case-fold-search t))
@@ -331,7 +333,9 @@ forbidden in URL encoding."
(t (byte-to-string code))))
str (substring str (match-end 0)))))
(setq tmp (concat tmp str))
- tmp))
+ (if coding-system
+ (decode-coding-string tmp coding-system)
+ tmp)))
(defconst url-unreserved-chars
'(