emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Maus <dmaus@ictsoc.de>
To: nicholas.dokos@hp.com
Cc: David Maus <dmaus@ictsoc.de>, Jeff Horn <jrhorn424@gmail.com>,
	Org-mode ml <emacs-orgmode@gnu.org>
Subject: Re: [bug] Org link dialog escapes URL spaces incorrectly
Date: Sun, 13 Nov 2011 10:12:42 +0100	[thread overview]
Message-ID: <87ehxcper9.wl%dmaus@ictsoc.de> (raw)
In-Reply-To: <835.1320618546@alphaville.dokosmarshall.org>

[-- Attachment #1: Type: text/plain, Size: 2700 bytes --]

First sorry for the late response, some pressing family matters kept
me busy last week.

At Sun, 06 Nov 2011 17:29:06 -0500,
Nick Dokos wrote:
> No, I mean the handling in org-insert-link itself:
>
> line 9048 says
>
>      	    (setq link (org-extract-attributes
> 			(org-link-unescape (org-match-string-no-properties 1))))

This is step 4: Org reads a bracket link from the buffer and these
links are expected to be escaped (step 2). The unescape restores the
original link.

> but further down, on line 9114 the link is not unescaped:
>
> 	    (setq link
> 		  (let ((org-completion-use-ido nil)
> 			(org-completion-use-iswitchb nil))
> 		    (org-completing-read
> 		     "Link: "
> 		     (append
> 		      (mapcar (lambda (x) (list (concat x ":")))
> 			      all-prefixes)
> 		      (mapcar 'car org-stored-links))
> 		     nil nil nil
> 		     'tmphist
> 		     (car (car org-stored-links)))))
Here we read the user's input and provide completion for stored links
and registered link types. There's no need to unescape the link, we
assume that whatever the user enters here is the link in its normal
form.

In both cases the minibuffer contains a link in its normal form. In
the first case obtaining the normal form requires unescaping because
whatever the user enters in the minibuffer is escaped once before
written to buffer.

To make things a little bit clearer lets look into the specs
(RFC3986):

#+begin_quote
2.4.  When to Encode or Decode

   Under normal circumstances, the only time when octets within a URI
   are percent-encoded is during the process of producing the URI from
   its component parts.  This is when an implementation determines which
   of the reserved characters are to be used as subcomponent delimiters
   and which can be safely used as data.  Once produced, a URI is always
   in its percent-encoded form.
#+end_quote

In other words: Steps 2 and 4, escaping and unescaping when a link is
written to or read from the buffer has nothing to do with
percent-escaping of URIs. Org just happens to use the percent-escaping
algorithm to store a link in the buffer and encode special chars
(i.e. brackets).

After reading the specs I'm quite confident that dropping the
percent-escaping of HTTP links in `org-open-at-point' is the right
thing to do: If you paste a URI from the browser or enter it manually
Org does not *produce* the URI and therefor is not responsible for
proper escaping or unescaping.

I think we should remove the percent-escaping in `org-open-at-point'
after 7.8 was released and see if this works out without breaking to
many links.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #2: Type: application/pgp-signature, Size: 230 bytes --]

  reply	other threads:[~2011-11-13  9:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-02  2:02 [bug] Org link dialog escapes URL spaces incorrectly Jeff Horn
2011-11-04 15:59 ` Jeff Horn
2011-11-04 16:14   ` Nick Dokos
2011-11-04 16:33   ` Nick Dokos
2011-11-04 16:52     ` Nick Dokos
     [not found]       ` <CALbR623mDyhC=LRAQBW9-vJxhsFWR0L+xFOKnE3eq5Wn92y04g@mail.gmail.com>
2011-11-04 18:19         ` Nick Dokos
2011-11-04 18:25       ` Nick Dokos
2011-11-05 14:04         ` David Maus
2011-11-05 15:38           ` Nick Dokos
2011-11-06 14:48             ` David Maus
2011-11-06 22:29               ` Nick Dokos
2011-11-13  9:12                 ` David Maus [this message]
2011-11-13 17:32                   ` Nick Dokos
2011-12-15  1:30                     ` Jeff Horn
2011-12-18 17:13                       ` David Maus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ehxcper9.wl%dmaus@ictsoc.de \
    --to=dmaus@ictsoc.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=jrhorn424@gmail.com \
    --cc=nicholas.dokos@hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).