2

I need to use Emacs built-in url.el url-unhex-string to decode uri (e.g. /%E5%85%B6%E4%BB%96/other)

It works, but all non-ascii (I guess it should be Unicode) characters are all converted into integers with backslashes (e.g. /\345\205\266\344\273\226/other

Can I encode these integers back to correct characters? Emacs built-in function is prefered.

2

Just found solution: use decode-coding-string:

(url-unhex-string "/%E5%85%B6%E4%BB%96/other") 
;; => "/\345\205\266\344\273\226/other"
(decode-coding-string (url-unhex-string "/%E5%85%B6%E4%BB%96/other") 'utf-8) 
;; => "/其他/other"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.