From mboxrd@z Thu Jan 1 00:00:00 1970 From: Edward Lilley Subject: Encoded slashes in capture protocol URIs (via Chromium) Date: Sat, 04 Dec 2010 14:23:55 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=33424 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1POtat-0003fJ-0d for emacs-orgmode@gnu.org; Sat, 04 Dec 2010 10:00:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1POtar-0003w7-Ey for emacs-orgmode@gnu.org; Sat, 04 Dec 2010 10:00:10 -0500 Received: from lo.gmane.org ([80.91.229.12]:44676) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1POtar-0003vr-6N for emacs-orgmode@gnu.org; Sat, 04 Dec 2010 10:00:09 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1POtan-000092-LR for emacs-orgmode@gnu.org; Sat, 04 Dec 2010 16:00:05 +0100 Received: from cpc6-cmbg15-2-0-cust240.5-4.cable.virginmedia.com ([213.81.89.241]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 04 Dec 2010 16:00:05 +0100 Received: from ejlilley by cpc6-cmbg15-2-0-cust240.5-4.cable.virginmedia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 04 Dec 2010 16:00:05 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org I've just had quite a bit of trouble setting up org capture protocol handling with the Chromium web browser. Using the Javascript function encodeURIComponent() replaces slashes with a %2F, as expected; the problem is then that xdg-open fails to open URIs containing %2F. Eventually I realised that xdg-open *can* accept a %2F, but *only* if it comes after a "?" in the URI. So, as an ugly hack, I set the identifying character for the org-capture template that handles my bookmarks to be a "?"; this way, any occurrence of %2F will come after a "?", so xdg-open won't complain! So the bookmarklet (attached to the F4 key in chromium, using the "yakshave" extension" looks like this: yak.bindings.add({ '': { onkeydown: function(event) { eval('location.href="org-protocol:/capture:/?/" + encodeURIComponent(location.href) + "/" + encodeURIComponent(document.title) + "/" + encodeURIComponent(window.getSelection());'); } } }); Of course this is basically a horrible hack; but it might help some of you out very slightly! -- Edward Lilley http://www.ugnus.uk.eu.org/~edward/