unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
To: emacs-devel@gnu.org
Subject: [william.xwl@gmail.com: webjump-url-encode and non-ascii characters]
Date: Sun, 08 Jul 2007 18:23:53 -0400	[thread overview]
Message-ID: <E1I7fAX-0001X4-Hc@fencepost.gnu.org> (raw)

Would someone please DTRT then ack?

------- 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-08 22:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-08 22:23 Richard Stallman [this message]
     [not found] <E1ICpXt-00033U-DV@fencepost.gnu.org>
2007-07-24  1:52 ` [william.xwl@gmail.com: webjump-url-encode and non-ascii characters] Kenichi Handa
2007-07-24  3:36   ` 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

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=E1I7fAX-0001X4-Hc@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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).