url-decode-url missing

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

url-decode-url missing

Juri Linkov-2
There is 'url-encode-url' in lisp/url/url-util.el, but
no inverse function with the expected name 'url-decode-url'.

There is a pair of url-hexify-string/url-unhex-string,
and it seems url-unhex-string does something like decoding,
but its output is garbled text.  For example:

(let ((url "https://en.wiktionary.org/wiki/Ω"))
  (string-equal url (url-unhex-string (url-encode-url url))))
=> nil

Using decode-coding-string doesn't help either:

(let ((url "https://en.wiktionary.org/wiki/Ω"))
  (string-equal url (decode-coding-string
                     (url-unhex-string (url-encode-url url))
                     'utf-8)))
=> nil

Reply | Threaded
Open this post in threaded view
|

Re: url-decode-url missing

Andreas Schwab-2
On Nov 03 2019, Juri Linkov wrote:

> Using decode-coding-string doesn't help either:
>
> (let ((url "https://en.wiktionary.org/wiki/Ω"))
>   (string-equal url (decode-coding-string
>                      (url-unhex-string (url-encode-url url))
>                      'utf-8)))
> => nil

That works for me.

Andreas.

--
Andreas Schwab, [hidden email]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

Reply | Threaded
Open this post in threaded view
|

Re: url-decode-url missing

Juri Linkov-2
>> Using decode-coding-string doesn't help either:
>>
>> (let ((url "https://en.wiktionary.org/wiki/Ω"))
>>   (string-equal url (decode-coding-string
>>                      (url-unhex-string (url-encode-url url))
>>                      'utf-8)))
>> => nil
>
> That works for me.

Thanks for trying.  I didn't expect that the result would be different
in 'emacs -Q'.  I'll investigate what is wrong in configuration
(and this is not a bug report).