List Info

Thread: url-hexify-string does not follow W3C spec]




url-hexify-string does not follow W3C spec]
user name
2006-07-30 13:14:25
Would someone please DTRT?

------- Start of forwarded message -------
From: "Davinessto" <davidsmithacm.org>
To: emacs-pretest-buggnu.org
Date: Sun, 30 Jul 2006 05:29:50 +0900
MIME-Version: 1.0
Subject: [patch] url-hexify-string does not follow W3C spec
Content-Type: multipart/mixed;
boundary="===============1391979861=="
X-Spam-Status: No, score=0.0 required=5.0 tests=none
autolearn=failed 
	version=3.0.4

- --===============1391979861==
Content-Type: multipart/signed;
boundary="=-=-=";
	micalg=pgp-sha1;
protocol="application/pgp-signature"

- --=-=-=
Content-Transfer-Encoding: quoted-printable

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

Thanks,
=2D-=20
  David D. Smith

- --=-=-=
Content-Type: application/pgp-signature

- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFEy8VGEJGOueZRHH4RAmWmAJ9JMak1qheySPaTp6jaqsaxovHjgACg
kFO+
zbUH6GB4KFjR8Li2EjWH4Ck=
=jmDi
- -----END PGP SIGNATURE-----
- --=-=-=--



- --===============1391979861==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-buggnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

- --===============1391979861==--
------- End of forwarded message -------


_______________________________________________
Emacs-devel mailing list
Emacs-develgnu.org
htt
p://lists.gnu.org/mailman/listinfo/emacs-devel
url-hexify-string does not follow W3C spec]
user name
2006-07-30 20:24:07
> From: "Davinessto" <davidsmithacm.org>
> Date: Sun, 30 Jul 2006 05:29:50 +0900
>
> the string must be converted to hexadecimal UTF-8 and
every
> hexadecimal byte must be prefixed with a % character.

thanks for pointing this out.
i have rewritten `url-hexify-string'.

thi


_______________________________________________
Emacs-devel mailing list
Emacs-develgnu.org
htt
p://lists.gnu.org/mailman/listinfo/emacs-devel
url-hexify-string does not follow W3C spec]
user name
2006-07-31 00:59:12
>>>>> On 30 Jul 2006 16:24:07 -0400,
Thien-Thi Nguyen <ttngnu.org> said:

>> the string must be converted to hexadecimal UTF-8
and every
>> hexadecimal byte must be prefixed with a %
character.

> thanks for pointing this out.  i have rewritten
`url-hexify-string'.

This change breaks the following case:

(concat
 "file://localhost"
 (mapconcat 'url-hexify-string
	    (split-string
	     (encode-coding-string
"/SOME/NONASCII/FILE/NAME"
				   (or file-name-coding-system
				       default-file-name-coding-system))
	     "/")
	    "/"))

Maybe suppress encoding with UTF-8 for unibyte strings?

				     YAMAMOTO Mitsuharu
				mituharumath.s.chiba-u.ac.jp


_______________________________________________
Emacs-devel mailing list
Emacs-develgnu.org
htt
p://lists.gnu.org/mailman/listinfo/emacs-devel
[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )