Function: hypb:decode-url
hypb:decode-url is a byte-compiled function defined in hypb.el.
Signature
(hypb:decode-url URL-FILE-NAME)
Documentation
Decode a URL-FILE-NAME.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hypb.el
;; Copied from eww.el, eww-decode-url-file-name, so as to not require
;; that package.
(defun hypb:decode-url (url-file-name)
"Decode a URL-FILE-NAME."
(let* ((binary (url-unhex-string url-file-name))
(decoded
(decode-coding-string
binary
;; Possibly set by `universal-coding-system-argument'.
(or coding-system-for-read
;; RFC 3986 says that %AB stuff is utf-8.
(if (equal (decode-coding-string binary 'utf-8)
'(unicode))
'utf-8
;; But perhaps not.
(car (detect-coding-string binary))))))
(encodes (find-coding-systems-string decoded)))
(if (or (equal encodes '(undecided))
(memq (coding-system-base (or file-name-coding-system
default-file-name-coding-system))
encodes))
decoded
;; If we can't encode the decoded file name (due to language
;; environment settings), then we return the original, hexified
;; string.
url-file-name)))