Discussion:
[mh-e:bugs] #229 url-hexify-string does not handle non-Latin characters
Bill Wohler
2016-01-18 05:48:48 UTC
Permalink
- **status**: unread --> open



---

** [bugs:#229] url-hexify-string does not handle non-Latin characters**

**Status:** open
**Milestone:** mh-e-8.0
**Created:** Wed Nov 15, 2006 05:45 AM UTC by Bill Wohler
**Last Updated:** Sat Feb 23, 2013 09:17 PM UTC
**Owner:** nobody


"David Smith" <***@acm.org> wrote to the emacs-pretest-***@gnu.org mailing list:

url-hexify-string does not handle non-latin characters. According to http://www.w3.org/International/O-URL-code.html , the string must be converted to hexadecimal UTF-8 and every hexadecimal byte must be prefixed with a % character. Rewritten url-hexify-string is below:

\(defun url-hexify-string \(str\)
"Escape characters in a string."
\(mapconcat
\(lambda \(char\)
;; Fixme: use a char table instead.
\(if \(not \(memq char url-unreserved-chars\)\)
\(if \(< char 16\)
\(format "%%0%x" char\)
\(let \(\(ins nil\)\)
\(mapconcat=20
\(lambda \(charhex\)
\(progn \(setq ins \(not ins\)\)
\(if ins \(concat "%" \(char-to-string charhex\)\)
\(char-to-string charhex\)\)\)\)
\(format "%x" char\) ""\)\)\)
\(char-to-string char\)\)\)
\(encode-coding-string str 'utf-8\) ""\)\)

Important settings:
value of $LC\_ALL: ja\_JP.utf8
value of $LC\_COLLATE: nil
value of $LC\_CTYPE: ja\_JP.utf8
value of $LC\_MESSAGES: nil
value of $LC\_MONETARY: nil
value of $LC\_NUMERIC: nil
value of $LC\_TIME: nil
value of $LANG: ja\_JP
locale-coding-system: utf-8-unix
default-enable-multibyte-characters: t

Check that this function is in Emacs 22, and then update the version in mh-compat.el with it.


---

Sent from sourceforge.net because mh-e-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/mh-e/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/mh-e/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Loading...