[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: address@hidden: webjump-url-encode and non-ascii characters]
From: |
Kenichi Handa |
Subject: |
Re: address@hidden: webjump-url-encode and non-ascii characters] |
Date: |
Tue, 24 Jul 2007 10:52:28 +0900 |
User-agent: |
SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/23.0.0 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) |
Sorry for the late response.
In article <address@hidden>, Richard Stallman <address@hidden> writes:
> [I sent this message a weeks ago but did not get a response.
> Is this in your area? I would expect it is, since it deals
> with non-ASCII characters, but maybe it isn't. If it isn't,
> please say so.
> Please respond!]
> Is this patch correct? Most particularly, is it correct to use
> buffer-file-coding-system for a URL? I have doubts about that.
I doubts too. I'm not the expert of URL (or URI) encoding,
but, as far as I remember, non-ASCII characters in URL must
be at first encoded by UTF-8 then by %-encoding. So, for
instance, $(D+"(B (U+00E0) must be encoded to "%C3%80".
---
Kenichi Handa
address@hidden
> ------- Start of forwarded message -------
> X-Spam-Status: No, score=1.3 required=5.0 tests=RCVD_NUMERIC_HELO,
> SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY autolearn=no version=3.1.0
> To: address@hidden
> From: William Xu <address@hidden>
> Date: Wed, 04 Jul 2007 18:34:51 +0800
> Organization: the Church of Emacs
> Mime-Version: 1.0
> Content-Type: text/plain; charset=utf-8
> Subject: webjump-url-encode and non-ascii characters
> webjump-url-encode fails to encode non-ascii characters correctly.
> Here's a patch:
> - --- webjump.el 2007-06-03 14:54:53.000000000 +0800
> +++ webjump.el.new 2007-07-04 18:29:41.000000000 +0800
> @@ -451,14 +451,13 @@
> (defun webjump-url-encode (str)
> (mapconcat '(lambda (c)
> - - (cond ((= c 32) "+")
> - - ((or (and (>= c ?a) (<= c ?z))
> - - (and (>= c ?A) (<= c ?Z))
> - - (and (>= c ?0) (<= c ?9)))
> - - (char-to-string c))
> - - (t (upcase (format "%%%02x" c)))))
> - - str
> - - ""))
> + (let ((s (char-to-string c)))
> + (cond ((string= s " ") "+")
> + ((string-match "[a-zA-Z_.-/]" s) s)
> + (t (upcase (format "%%%02x" c))))))
> + (string-to-list
> + (encode-coding-string str buffer-file-coding-system))
> + ""))
> (defun webjump-url-fix (url)
> (if (webjump-null-or-blank-string-p url)
> - --
> William
> ????????
> ????????????
> ????????????????????????????????
> ????????????????????????????????
> _______________________________________________
> Emacs-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-devel
> ------- End of forwarded message -------
- Re: address@hidden: webjump-url-encode and non-ascii characters],
Kenichi Handa <=
- Re: address@hidden: webjump-url-encode and non-ascii characters], William, 2007/07/24
- Re: address@hidden: webjump-url-encode and non-ascii characters], Kenichi Handa, 2007/07/24
- Re: address@hidden: webjump-url-encode and non-ascii characters], William Xu, 2007/07/24
- Re: address@hidden: webjump-url-encode and non-ascii characters], Kenichi Handa, 2007/07/24
- Re: address@hidden: webjump-url-encode and non-ascii characters], William Xu, 2007/07/24
- Re: address@hidden: webjump-url-encode and non-ascii characters], Stefan Monnier, 2007/07/25
- Re: address@hidden: webjump-url-encode and non-ascii characters], William Xu, 2007/07/25
- Re: address@hidden: webjump-url-encode and non-ascii characters], Stefan Monnier, 2007/07/25
- Re: address@hidden: webjump-url-encode and non-ascii characters], William Xu, 2007/07/25
- Re: address@hidden: webjump-url-encode and non-ascii characters], Stefan Monnier, 2007/07/25