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

David Maus <dmaus@ictsoc.de> wrote:

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

OK - thanks for the checking and the info.

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

Good enough for me. I don't remember whether you supplied a patch for this
(sorry, no time to check atm) but if you did, maybe the OP can test it and
make sure that it does what he expected (or maybe he's done that already -
I can't remember and I'm completely discombobulated right now, even more than
usual).

Thanks,
Nick

  reply	other threads:[~2011-11-13 17:32 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
2011-11-13 17:32                   ` Nick Dokos [this message]
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=19585.1321205555@alphaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=dmaus@ictsoc.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=jrhorn424@gmail.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).