emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r107826: (url-unhex-string): Add a


From: Lars Magne Ingebrigtsen
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r107826: (url-unhex-string): Add an optional CODING-SYSTEM parameter.
Date: Fri, 02 Nov 2012 01:45:59 -0000
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 107826
fixes bug: http://debbugs.gnu.org/6252
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Tue 2012-04-10 04:14:13 +0200
message:
  (url-unhex-string): Add an optional CODING-SYSTEM parameter.
modified:
  lisp/url/ChangeLog
  lisp/url/url-util.el
=== modified file 'lisp/url/ChangeLog'
--- a/lisp/url/ChangeLog        2012-04-10 01:57:45 +0000
+++ b/lisp/url/ChangeLog        2012-04-10 02:14:13 +0000
@@ -1,5 +1,8 @@
 2012-04-10  Lars Magne Ingebrigtsen  <address@hidden>
 
+       * 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.

=== modified file 'lisp/url/url-util.el'
--- a/lisp/url/url-util.el      2012-01-19 07:21:25 +0000
+++ b/lisp/url/url-util.el      2012-04-10 02:14:13 +0000
@@ -308,11 +308,13 @@
 ;;     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 @@
                    (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
   '(


reply via email to

[Prev in Thread] Current Thread [Next in Thread]