[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22912: url-util: add url-hexify-region, url-unhex-region
From: |
Ivan Shmakov |
Subject: |
bug#22912: url-util: add url-hexify-region, url-unhex-region |
Date: |
Fri, 04 Mar 2016 20:40:31 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Package: emacs
Severity: wishlist
Just like there’s, say, encode-coding-region, interactive
url-unhex-region and its inverse come handy at times. Say, one
may stumble upon a URI like [1], which is hardly legible without
applying url-unhex-region first.
Please thus consider adding functions like those MIMEd to
url-util.el.
[1]
https://ru.wikipedia.org/wiki/%D0%A4%D0%BE%D0%BD%D0%B4_%D1%81%D0%B2%D0%BE%D0%B1%D0%BE%D0%B4%D0%BD%D0%BE%D0%B3%D0%BE_%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D0%BD%D0%BE%D0%B3%D0%BE_%D0%BE%D0%B1%D0%B5%D1%81%D0%BF%D0%B5%D1%87%D0%B5%D0%BD%D0%B8%D1%8F
--
FSF associate member #7257 http://am-1.org/~ivan/ … 3013 B6A0 230E 334A
(defun url-hexify-region (from to &optional coding)
"URI-encode the current region.
If the region contains multibyte characters, they are first converted to
UTF-8, or to CODING-SYSTEM if non-nil."
(interactive "r")
(insert (prog1
(url-hexify-string
(encode-coding-string
(buffer-substring from to)
(or coding 'utf-8)))
(delete-region from to))))
(defun url-unhex-region (from to &optional coding)
"URI-decode the current region.
If CODING is non-nil, use it as the coding system to decode from.
Otherwise, use UTF-8."
(interactive "r")
(insert (prog1
(decode-coding-string
(url-unhex-string
(buffer-substring from to))
(or coding 'utf-8))
(delete-region from to))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#22912: url-util: add url-hexify-region, url-unhex-region,
Ivan Shmakov <=