From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: William Xu Newsgroups: gmane.emacs.devel Subject: Re: [william.xwl@gmail.com: webjump-url-encode and non-ascii characters] Date: Tue, 24 Jul 2007 21:31:07 +0900 Organization: the Church of Emacs Message-ID: <87sl7easqc.fsf@www.williamxu.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1185280328 13435 80.91.229.12 (24 Jul 2007 12:32:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 24 Jul 2007 12:32:08 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 24 14:32:04 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IDJYY-0008Bi-5k for ged-emacs-devel@m.gmane.org; Tue, 24 Jul 2007 14:32:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IDJYX-0001Sp-IX for ged-emacs-devel@m.gmane.org; Tue, 24 Jul 2007 08:32:01 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IDJYU-0001Sc-Ly for emacs-devel@gnu.org; Tue, 24 Jul 2007 08:31:58 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IDJYS-0001S7-3B for emacs-devel@gnu.org; Tue, 24 Jul 2007 08:31:57 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IDJYR-0001S4-Tb for emacs-devel@gnu.org; Tue, 24 Jul 2007 08:31:55 -0400 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IDJYR-0001sb-F5 for emacs-devel@gnu.org; Tue, 24 Jul 2007 08:31:55 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IDJYJ-0005V6-C2 for emacs-devel@gnu.org; Tue, 24 Jul 2007 14:31:47 +0200 Original-Received: from gw.community-engine.co.jp ([210.255.51.230]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 24 Jul 2007 14:31:47 +0200 Original-Received: from william.xwl by gw.community-engine.co.jp with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 24 Jul 2007 14:31:47 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 48 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: gw.community-engine.co.jp User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.0 (gnu/linux) Cancel-Lock: sha1:lc9A1rrP9CCqDFACvfBTAVhhkwM= X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:75450 Archived-At: Kenichi Handa 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 《蜀先主庙》 作者:刘禹锡 天地英雄气,千秋尚凛然。 势分三足鼎,业复五铢钱。 得相能开国,生儿不象贤。 凄凉蜀故妓,来舞魏宫前。