]> git.eshelyaron.com Git - emacs.git/commitdiff
(url-unhex-string): Add an optional CODING-SYSTEM parameter.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 10 Apr 2012 02:14:13 +0000 (04:14 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 10 Apr 2012 02:14:13 +0000 (04:14 +0200)
Fixes: debbugs:6252
lisp/url/ChangeLog
lisp/url/url-util.el

index 4c9635f8ecf3c6cf2fc8a2b97fe7158255fe8204..c2350e56594cb384396c22726d0e9ea8edbe41ea 100644 (file)
@@ -1,5 +1,8 @@
 2012-04-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * url-util.el (url-unhex-string): Add an optional CODING-SYSTEM
+       parameter (bug#6252).
+
        * url-domsurf.el: New file (bug#1401).
 
        * url-cookie.el (url-cookie-two-dot-domains): Remove.
index 848eb66e54bc1351349aeaf8bf5d0ea5a5fc8535..c62b820c2e75c03d9fd0f7285b71df4524ee4e8b 100644 (file)
@@ -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
   '(