mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-13 00:40:04 +00:00
New unicode aware percent encoding algorithm
* org.el (org-link-escape): New unicode aware percent encoding algorithm.
This commit is contained in:
parent
196a9d7b2b
commit
0c4bb0e406
19
lisp/org.el
19
lisp/org.el
|
@ -8636,17 +8636,14 @@ This is the list that is used before handing over to the browser.")
|
||||||
(if (and org-url-encoding-use-url-hexify (not table))
|
(if (and org-url-encoding-use-url-hexify (not table))
|
||||||
(url-hexify-string text)
|
(url-hexify-string text)
|
||||||
(setq table (or table org-link-escape-chars))
|
(setq table (or table org-link-escape-chars))
|
||||||
(when text
|
(mapconcat
|
||||||
(let ((re (mapconcat (lambda (x) (regexp-quote
|
(lambda (char)
|
||||||
(char-to-string (car x))))
|
(if (or (assoc char table)
|
||||||
table "\\|")))
|
(< char 32) (> char 126))
|
||||||
(while (string-match re text)
|
(mapconcat (lambda (sequence)
|
||||||
(setq text
|
(format "%%%.2X" sequence))
|
||||||
(replace-match
|
(encode-coding-char char 'utf-8) "")
|
||||||
(cdr (assoc (string-to-char (match-string 0 text))
|
(char-to-string char))) text "")))
|
||||||
table))
|
|
||||||
t t text)))
|
|
||||||
text))))
|
|
||||||
|
|
||||||
(defun org-link-unescape (text &optional table)
|
(defun org-link-unescape (text &optional table)
|
||||||
"Reverse the action of `org-link-escape'."
|
"Reverse the action of `org-link-escape'."
|
||||||
|
|
Loading…
Reference in a new issue