From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: michael@cadilhac.name (=?iso-8859-1?Q?Micha=EBl?= Cadilhac) Newsgroups: gmane.emacs.devel Subject: Re: Your last change to browse-url is bogus. Date: Wed, 12 Sep 2007 13:09:57 +0200 Organization: Epita/LRDE Message-ID: <87abrs2l8a.fsf@cadilhac.name> References: <87zlzs2qm1.fsf@cadilhac.name> <20070912102039.GD12104@saeurebad.de> <87ejh42mo4.fsf@cadilhac.name> <20070912104902.GA3696@saeurebad.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1293170223==" X-Trace: sea.gmane.org 1189595644 14326 80.91.229.12 (12 Sep 2007 11:14:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 12 Sep 2007 11:14:04 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 12 13:14:01 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 1IVQAP-0004Az-PI for ged-emacs-devel@m.gmane.org; Wed, 12 Sep 2007 13:13:58 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IVQAN-0004HG-6N for ged-emacs-devel@m.gmane.org; Wed, 12 Sep 2007 07:13:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IVQAI-0004GE-Hl for emacs-devel@gnu.org; Wed, 12 Sep 2007 07:13:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IVQAG-0004Ex-PT for emacs-devel@gnu.org; Wed, 12 Sep 2007 07:13:49 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IVQAG-0004Ej-Fr for emacs-devel@gnu.org; Wed, 12 Sep 2007 07:13:48 -0400 Original-Received: from smtp3-g19.free.fr ([212.27.42.29]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IVQAF-0000if-U9 for emacs-devel@gnu.org; Wed, 12 Sep 2007 07:13:48 -0400 Original-Received: from smtp3-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp3-g19.free.fr (Postfix) with ESMTP id 71E255A0B0 for ; Wed, 12 Sep 2007 13:13:47 +0200 (CEST) Original-Received: from localhost (ivr94-6-82-230-255-91.fbx.proxad.net [82.230.255.91]) by smtp3-g19.free.fr (Postfix) with ESMTP id 2CE385A163 for ; Wed, 12 Sep 2007 13:13:47 +0200 (CEST) X-Website: http://michael.cadilhac.name Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEVWPh+Tai+5r5YKBAEU CQQzGAtiq7gjAAACR0lEQVQ4jW2UzW7lIAyFzVW8BzTZX5DmCZLuU2H2pMXv/ypzbK7aSh2kRCRf /HNsE0q7Sg+RQ7JFKaqtrRNAl5AIIKe6D5DBqgbmUAe5hBI1wIRFAHjeM0RKtZi7XVVEpb0BSNfA IddChChT5DildSLWOWhY5IEItMnncZgFcUAc/5jjwCMsDosRNdfKPDTFEdVBW8C+RebDb4N5Orio RhM1+11IJyx0ng2+LryFHBMPDQDYHrY6IfGuU3ouiXTQNE8LIJDKOWpNxERTFrggQwRPd7USUsTW fJ0XbR3bdj5KgBYy4SACpxDeUYEUAzLmtJ1iIrD2gczPq8Qomjhsh/RjGIgKIO8p7NITjwlx7WID nsnQe5NeuTvoBpi8LX6vLLOh5icjOHqBypgnuSp7M+RE1agbQKHQr5E2z1WObhYW4gMqeGQL7joM jCf2DxSk5ApADSYHfFF4igNfJZL1z0GKP0FN02s4XiDXr7V5P94W6I9v8MfBOQDmfwAaVYt+x8Da v4DJvX8BAdin3Knm5yMZYAO4ABDkDniZLLfi4P40gP1F0TPGZOu0CGwA1lcowxwlGy6A9705mD0V jHCxwVZT/hYdRJVUGZNlx6l7ScQBTluof6Wj6bsPYlvpwoTvXFD9gHPn2TZPF3ntI2ecxVrW5MrV XiCie5EeNa7BlWu/HNSkprDUva163PHxAv5jyGV7gVzyAghSKOTnat85UIYFICXbD2NV9rRiv0BS tKQsg6OHH4A15F1WW+UHKHHa32h6aPnAm3/pUcWp+WYnTQAAAABJRU5ErkJggg== In-Reply-To: <20070912104902.GA3696@saeurebad.de> (Johannes Weiner's message of "Wed, 12 Sep 2007 12:49:02 +0200") User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.50 (gnu/linux) X-Detected-Kernel: Linux 2.4-2.6 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:78660 Archived-At: --===============1293170223== Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hi Johannes! Johannes Weiner writes: >> > These use mostly the same argument. Can't we generalize this? Would = it hurt >> > the callsites if they all would use "[*\"()',=3D;? ]"? >>=20 >> Yes, it will. A ``confusing char'' is just something Firefox or others >> can consider as a URL separator or as a variable or something when the >> website is passed as an argument to the executable, AFAIU. >>=20 >> `?=3D*' for example are not usually ``confusing''. The only place those >> chars are to be converted is when we browse for a file (thus when `?=3D' >> don't have their special meanings). > > Ah, okay. So what about an (&optional filename) for this function? > And if it's true, the character set to be translated is "[*\"()',=3D;? ]"= and > percent is also encoded. If ommited (nil), just "[,)$]" will be translat= ed. > > How does that sound? Yeah, it seems like a good idea=A0: I already added encode-percent, which had this role but didn't integrate the regexps. But it's true that if in 2013 a new web-browser adds a special meaning for `*' in its executable parameter, it'll not hurt to encode it for all the other web-browsers. Great, so we're now here=A0: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=browse-url.patch Content-Transfer-Encoding: quoted-printable =2D-- browse-url.el 12 Sep 2007 10:49:04 +0200 1.61 +++ browse-url.el 12 Sep 2007 13:04:52 +0200=09 @@ -619,16 +619,19 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; URL encoding =20 =2D(defun browse-url-encode-url (url) =2D "Encode all `confusing' characters in URL." =2D (let ((encoded-url (copy-sequence url))) =2D (while (string-match "%" encoded-url) =2D (setq encoded-url (replace-match "%25" t t encoded-url))) =2D (while (string-match "[*\"()',=3D;? ]" encoded-url) +(defun browse-url-encode-url (url &optional filename-p) + "Encode all `confusing' characters in URL. +If FILENAME-P is nil, the confusing characters are [,)$]. +Otherwise, the confusing characters are [*\"()',=3D;?% ]." + (let ((conf-char (if filename-p "[*\"()',=3D;?% ]" "[,)$]")) + (encoded-url (copy-sequence url)) + (s 0)) + (while (setq s (string-match conf-char encoded-url s)) (setq encoded-url (replace-match (format "%%%x" (string-to-char (match-string 0 encoded-url))) =2D t t encoded-url))) + t t encoded-url) + s (1+ s))) encoded-url)) =20 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -703,7 +706,7 @@ (or file-name-coding-system default-file-name-coding-system)))) (if coding (setq file (encode-coding-string file coding)))) =2D (setq file (browse-url-encode-url file)) + (setq file (browse-url-encode-url file 'url-is-filename)) (dolist (map browse-url-filename-alist) (when (and map (string-match (car map) file)) (setq file (replace-match (cdr map) t nil file)))) --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable =2D-=20 | Micha=EBl `Micha' Cadilhac | Je veut dire que la loi francaise= | | http://michael.cadilhac.name | est overwritable par le = | | JID/MSN: | reglement interieur il me semble. = | `---- michael.cadilhac@gmail.com | -- ElBarto - = --' --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.2 (GNU/Linux) iD8DBQFG58kGUJhDmOfFA3URAv7NAJ4oK2ZAz73D7pOO/MKUJHlncEx/0gCgwLjd TYuz0UpdB8Tn25U0jEBn9FE= =Iqxr -----END PGP SIGNATURE----- --==-=-=-- --===============1293170223== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --===============1293170223==--