emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 9aa13cd: Make url-hexify-string accept a list of al


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 9aa13cd: Make url-hexify-string accept a list of allowed chars (bug#26469)
Date: Mon, 14 Oct 2019 00:46:58 -0400 (EDT)

branch: master
commit 9aa13cd4beccfe41e8f4930cb029bd60e7788e93
Author: Hong Xu <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Make url-hexify-string accept a list of allowed chars (bug#26469)
    
    * lisp/url/url-util.el (url-hexify-string): Accept a list of allowed
    chars.
    * doc/misc/url.texi (URI Encoding): Update url-hexify-string doc and
    index improvements (bug#24694).
---
 doc/misc/url.texi    | 8 ++++++--
 lisp/url/url-util.el | 9 ++++++---
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/doc/misc/url.texi b/doc/misc/url.texi
index e72d9bf..79dead1 100644
--- a/doc/misc/url.texi
+++ b/doc/misc/url.texi
@@ -221,6 +221,7 @@ URI's @var{port} slot is @code{nil}.
 @section URI Encoding
 
 @cindex percent encoding
+@findex url-generic-parse-url
   The @code{url-generic-parse-url} parser does not obey RFC 3986 in
 one respect: it allows non-@acronym{ASCII} characters in URI strings.
 
@@ -233,6 +234,7 @@ then percent encoded to @samp{%D3%A7}.  (Certain 
``reserved''
 @acronym{ASCII} characters must also be percent encoded when they
 appear in URI components.)
 
+@findex url-encode-url
   The function @code{url-encode-url} can be used to convert a URI
 string containing arbitrary characters to one that is properly
 percent-encoded in accordance with RFC 3986.
@@ -244,6 +246,8 @@ e.g., converting the scheme component to lowercase if it was
 previously uppercase.
 @end defun
 
+@findex url-hexify-string
+@findex url-unhex-string
   To convert between a string containing arbitrary characters and a
 percent-encoded all-@acronym{ASCII} string, use the functions
 @code{url-hexify-string} and @code{url-unhex-string}:
@@ -263,8 +267,8 @@ The allowed characters are specified by 
@var{allowed-chars}.  If this
 argument is @code{nil}, the allowed characters are those specified as
 @dfn{unreserved characters} by RFC 3986 (see the variable
 @code{url-unreserved-chars}).  Otherwise, @var{allowed-chars} should
-be a vector whose @var{n}-th element is non-@code{nil} if character
-@var{n} is allowed.
+be either a list of allowed chars, or a vector whose Nth element is
+non-nil if character N is allowed.
 @end defun
 
 @defun url-unhex-string string &optional allow-newlines
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index a390723..223a6ba 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -395,9 +395,12 @@ string: \"%\" followed by two upper-case hex digits.
 
 The allowed characters are specified by ALLOWED-CHARS.  If this
 argument is nil, the list `url-unreserved-chars' determines the
-allowed characters.  Otherwise, ALLOWED-CHARS should be a vector
-whose Nth element is non-nil if character N is allowed."
-  (unless allowed-chars
+allowed characters.  Otherwise, ALLOWED-CHARS should be either a
+list of allowed chars, or a vector whose Nth element is non-nil
+if character N is allowed."
+  (if allowed-chars
+      (unless (vectorp allowed-chars)
+        (setq allowed-chars (url--allowed-chars allowed-chars)))
     (setq allowed-chars (url--allowed-chars url-unreserved-chars)))
   (mapconcat (lambda (byte)
               (if (aref allowed-chars byte)



reply via email to

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