emacs url-unhex-string defect

Perm URL with updates: http://xahlee.org/emacs/emacs_bugs.html

The emacs functions {url-unhex-string, gnus-url-unhex-string} returns incorrect result. Example:

(require 'url-util)
;; emacs-24.1.50_2/lisp/url/url-util.el
(url-hexify-string "Gauss–Bonnet_theorem") ; returns "Gauss%E2%80%93Bonnet_theorem"

(url-unhex-string "Gauss%E2%80%93Bonnet_theorem")
;; returns "Gauss\342\200\223Bonnet_theorem"

(require 'gnus-util)
;; emacs-24.1.50_2/lisp/gnus/gnus-util.el
(gnus-url-unhex-string "Gauss%E2%80%93Bonnet_theorem")
;; returns "Gauss–Bonnet_theorem"

;; correct result should be: "Gauss–Bonnet_theorem"

Another issue is, why there's duplicate {url-unhex-string, gnus-url-unhex-string}?

Some discussion and temp solutions at:

Reported to FSF: bug#6252.

For browser's behavior, see: URL Percent Encoding and Unicode. For example of correct behavior in JavaScript, see: JavaScript Encode URL, Escape String.

Popular posts from this blog

Browser User Agent Strings 2012

11 Years of Writing About Emacs

does md5 creates more randomness?