all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: William Xu <william.xwl@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: [william.xwl@gmail.com: webjump-url-encode and non-ascii characters]
Date: Tue, 24 Jul 2007 21:31:07 +0900	[thread overview]
Message-ID: <87sl7easqc.fsf@www.williamxu.com> (raw)
In-Reply-To: E1IDBod-0003MR-La@etlken.m17n.org

Kenichi Handa <handa@m17n.org> writes:

> One more note about your change.
>
> As mapconcat accepts a sequence (including string),
> string-to-list is not necessary.

Correct, thanks ! Here's the updated patch.

cvs diff: Diffing .
Index: webjump.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/webjump.el,v
retrieving revision 1.4.6.10
diff -u -r1.4.6.10 webjump.el
--- webjump.el	30 May 2007 14:40:32 -0000	1.4.6.10
+++ webjump.el	24 Jul 2007 12:30:46 -0000
@@ -451,14 +451,12 @@
 
 (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))))))
+             (encode-coding-string str 'utf-8)
+             ""))
 
 (defun webjump-url-fix (url)
   (if (webjump-null-or-blank-string-p url)

-- 
William

《蜀先主庙》
作者:刘禹锡
天地英雄气,千秋尚凛然。
势分三足鼎,业复五铢钱。
得相能开国,生儿不象贤。
凄凉蜀故妓,来舞魏宫前。

  reply	other threads:[~2007-07-24 12:31 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 ` [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 [this message]
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

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

  git send-email \
    --in-reply-to=87sl7easqc.fsf@www.williamxu.com \
    --to=william.xwl@gmail.com \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.