emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Fabrice Popineau <fabrice.popineau@gmail.com>,
	Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Escaping links
Date: Fri, 11 Aug 2017 17:31:46 +0000	[thread overview]
Message-ID: <CAJ51ETqVq-ScA3_Ei1vxBmyN9YZHQX4T8yj0d=ZhNQWEOLBD3w@mail.gmail.com> (raw)
In-Reply-To: <87zib65e93.fsf@nicolasgoaziou.fr>

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

Could you put some magic at the beginning of the string that indicates it
is encoded?

On Fri, Aug 11, 2017 at 8:15 AM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Fabrice Popineau <fabrice.popineau@gmail.com> writes:
>
> > Are links to a file whose name already holds (url-)escaped chars
> supported?
> >
> > If I have a directory named "c:/temp/foo bar/"
> > and files in this directory named
> > foo.txt
> > foo bar.txt
> > foo%2Fbar.txt
> >
> > I can create links in an Org buffer by using `insert' but I find the
> > situation a bit confusing.
> >
> > #+LINK: temp file:c:/temp/%s
> >
> > 1. [[temp:foo bar/foo bar.txt]]
> > 2. [[temp:foo%20bar/foo bar.txt]]
> > 3. [[temp:foo bar/foo%20bar.txt]]
> > 4. [[temp:foo%20bar/foo%20bar.txt]]
> >
> >
> > All of these links seem to work the same way.
> >
> > 5. [[temp:foo bar/foo%2Fbar.txt]]
> > 6. [[temp:foo bar/foo%252Fbar.txt]]
> > 7. [[temp:foo%20bar/foo%252Fbar.txt]]
> >
> > Link 5 does not work.
> >
> > Link 6 and 7 do work: as long as I press enter on the link, I visit the
> > file.
> >
> > Unfortunately, if I edit these links with 'C-c C-l', doing nothing
> > (return), Org replaces the escaped chars and unescape them.
> >
> > I have grabbed files whose name hold such %2F %3A and so on escaped
> chars.
> > Do I have any option to make a link point at them or should I rename
> > them?
>
> You might get around it by not using link abbreviation.
>
> Anyway, the core problem here is that:
>
>   1. Org uses percent escaping to get around its own limitations (e.g., no
>      square brackets allowed in a link);
>   2. it's not possible to know if a string is percent-encoded or not;
>   3. percent-encoding is not idempotent.
>
> Using a different escaping mechanism to solve 1 and never ever
> percent-decode an URL could put an end to the link mess.
>
> Finding an escaping mechanism that also solves 2 is yet to be done.
>
>
> Regards,
>
> --
> Nicolas Goaziou
>
> --
John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

[-- Attachment #2: Type: text/html, Size: 3092 bytes --]

  reply	other threads:[~2017-08-11 17:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-11 13:26 Escaping links Fabrice Popineau
2017-08-11 15:13 ` Nicolas Goaziou
2017-08-11 17:31   ` John Kitchin [this message]
2017-08-11 19:54     ` Fabrice Popineau
2017-08-12 10:44     ` Nicolas Goaziou
2017-08-12 14:01       ` John Kitchin
2017-08-14 16:26         ` Neil Jerram
2017-08-14 16:35           ` Fabrice Popineau
2017-08-19  9:15             ` Nicolas Goaziou

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='CAJ51ETqVq-ScA3_Ei1vxBmyN9YZHQX4T8yj0d=ZhNQWEOLBD3w@mail.gmail.com' \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=fabrice.popineau@gmail.com \
    --cc=mail@nicolasgoaziou.fr \
    /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).