From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: [william.xwl@gmail.com: webjump-url-encode and non-ascii characters] Date: Sun, 08 Jul 2007 18:23:53 -0400 Message-ID: Reply-To: rms@gnu.org NNTP-Posting-Host: lo.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1183933494 1250 80.91.229.12 (8 Jul 2007 22:24:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 8 Jul 2007 22:24:54 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 09 00:24:53 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 1I7fBS-0002i9-N3 for ged-emacs-devel@m.gmane.org; Mon, 09 Jul 2007 00:24:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I7fBS-0004SD-6L for ged-emacs-devel@m.gmane.org; Sun, 08 Jul 2007 18:24:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I7fAM-0003UI-Je for emacs-devel@gnu.org; Sun, 08 Jul 2007 18:23:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I7fAL-0003Tr-Mv for emacs-devel@gnu.org; Sun, 08 Jul 2007 18:23:42 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I7fAL-0003Th-GL for emacs-devel@gnu.org; Sun, 08 Jul 2007 18:23:41 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I7fAL-0005j9-8J for emacs-devel@gnu.org; Sun, 08 Jul 2007 18:23:41 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.60) (envelope-from ) id 1I7fAX-0001X4-Hc; Sun, 08 Jul 2007 18:23:53 -0400 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:74480 Archived-At: 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 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 -------