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.

kuanyui
  • 1,020
  • 6
  • 16

1 Answers1

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"
kuanyui
  • 1,020
  • 6
  • 16