unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
To: rms@gnu.org
Cc: william.xwl@gmail.com, emacs-devel@gnu.org
Subject: Re: [william.xwl@gmail.com: webjump-url-encode and non-ascii characters]
Date: Tue, 24 Jul 2007 10:52:28 +0900	[thread overview]
Message-ID: <E1ID9Zc-0001A8-Lz@etlken.m17n.org> (raw)
In-Reply-To: <E1ICpXt-00033U-DV@fencepost.gnu.org> (message from Richard Stallman on Mon, 23 Jul 2007 00:29:21 -0400)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=ISO-2022-JP-2, Size: 2487 bytes --]

Sorry for the late response.

In article <E1ICpXt-00033U-DV@fencepost.gnu.org>, Richard Stallman <rms@gnu.org> 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
handa@m17n.org

> ------- 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: emacs-devel@gnu.org
> From: William Xu <william.xwl@gmail.com>
> 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
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel
> ------- End of forwarded message -------

       reply	other threads:[~2007-07-24  1:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1ICpXt-00033U-DV@fencepost.gnu.org>
2007-07-24  1:52 ` Kenichi Handa [this message]
2007-07-24  3:36   ` [william.xwl@gmail.com: webjump-url-encode and non-ascii characters] William
2007-07-24  4:16     ` Kenichi Handa
2007-07-24 12:31       ` William Xu
2007-07-25  0:55         ` Kenichi Handa
2007-07-25  2:35           ` William Xu
2007-07-25  4:30             ` Stefan Monnier
2007-07-25  4:50               ` William Xu
2007-07-25  6:50                 ` Stefan Monnier
2007-07-25  6:57                   ` William Xu
2007-07-25 14:48                     ` Stefan Monnier
2007-07-25 20:11               ` Richard Stallman
2007-07-26  2:22                 ` William Xu
2007-07-24 22:16   ` Richard Stallman
2007-07-25  0:56     ` Kenichi Handa
2007-07-08 22:23 Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1ID9Zc-0001A8-Lz@etlken.m17n.org \
    --to=handa@m17n.org \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    --cc=william.xwl@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).