unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [william.xwl@gmail.com: webjump-url-encode and non-ascii characters]
@ 2007-07-08 22:23 Richard Stallman
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Stallman @ 2007-07-08 22:23 UTC (permalink / raw)
  To: emacs-devel

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 -------

^ permalink raw reply	[flat|nested] 16+ messages in thread
[parent not found: <E1ICpXt-00033U-DV@fencepost.gnu.org>]

end of thread, other threads:[~2007-07-26  2:22 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-08 22:23 [william.xwl@gmail.com: webjump-url-encode and non-ascii characters] Richard Stallman
     [not found] <E1ICpXt-00033U-DV@fencepost.gnu.org>
2007-07-24  1:52 ` 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

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).