all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Maus <dmaus@ictsoc.de>
To: Nicolas Goaziou <n.goaziou@gmail.com>
Cc: David Maus <dmaus@ictsoc.de>,
	emacs-orgmode@gnu.org, Nick Dokos <ndokos@gmail.com>
Subject: Re: Encoding Problem in export?
Date: Fri, 26 Jul 2013 06:03:41 +0200	[thread overview]
Message-ID: <87r4emdl2a.wl%dmaus@ictsoc.de> (raw)
In-Reply-To: <87li4u48jp.fsf@gmail.com>

At Thu, 25 Jul 2013 23:46:34 +0200,
Nicolas Goaziou wrote:
> 
> Hello,
> 
> David Maus <dmaus@ictsoc.de> writes:
> 
> >
> > The bottom-line: Org creates link programmatically (org-store-link)
> > and needs a mechanism to protected conflicting characters. It chose
> > percent-escaping and in order to preserve the identity of a link Org
> > has to escape the escape-character.
> >
> > Hope that helps!
> 
> It does.
> 
> I think we are hunting two hares and that's why we are failing so far.
>
>
> There are two URI transformations involved. One is mandatory (escape
> square brackets in URI), and the other one is optional (normalize URI
> for external processes consumption). The former must be bi-directional,
> as escaping brackets must be transparent to the user (e.g., when editing
> a link with `org-insert-link'). The latter needn't and can happen on the
> fly, just before the URI is sent to whatever needs it (e.g., a browser).
> 
> Therefore, I suggest to use three functions:
> 
>   - `org-link-escape will first %-escape "%" characters, and then "["
>     and "]" characters. `org-link-unescape' will reverse the operation.
> 
>     These function cannot break a link, encoded or not. They are applied
>     when a link is created programmatically and read back for user
>     editing.

It's not just square brackets, but also non-ascii
characters. Consider a link that contains UTF-8 encoded characters and
is inserted into a Org buffer encoded in ISO-8859-1.

Oh, and: ASCII controll characters. A link description with newlines.

Obviously changing the algorithm of org-link-escape/unescape also
creates a BC-issue.

> 
>   - `org-link-encode'[1] will %-escape every forbidden character in the
>     URI. It doesn't need any "reverse" function. It will be called when
>     opening a link, or parsing it.
> 
>     I think it shouldn't escape "%" characters, though, so that it can
>     be applied on both encoded and plain strings. Since it isn't perfect
>     (it doesn't parse URI), it should also be very conservative (i.e.
>     allow more characters such as "=" or "&") and not get in the way.

You would have to select the list of forbidden characters based on the
link protocol. The assumption underlying the current implementation is
to delegate dealing with forbidden characters to the consuming
application. Thus I would limit this to known URI protocols,
i.e. http: and https:.

Best,
  -- David

> 
> WDYT?
> 
> 
> Regards,
> 
> [1] `url-encode-url' was introduced in Emacs 24.3. It is too young to be
> used mainstream, even though it does a better job than
> `org-link-escape'. We will benefit from it when Emacs 25 is out (i.e.
> when Emacs 23 support is dropped).
> 
> -- 
> Nicolas Goaziou
-- 
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

  reply	other threads:[~2013-07-26  4:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-23 23:17 Encoding Problem in export? Robert Eckl
2013-07-23 23:35 ` Nicolas Goaziou
2013-07-24  1:50   ` Robert Eckl
2013-07-24  7:34     ` Nicolas Goaziou
2013-07-24  8:46       ` Robert Eckl
2013-07-24  9:16         ` Nicolas Goaziou
2013-07-24 10:27           ` Robert Eckl
2013-07-24  9:39       ` Nick Dokos
2013-07-24 11:09         ` Nicolas Goaziou
2013-07-25  4:05           ` David Maus
2013-07-25 21:46             ` Nicolas Goaziou
2013-07-26  4:03               ` David Maus [this message]
2013-07-26 10:20                 ` Nicolas Goaziou
2013-07-27  7:23                   ` David Maus
2013-07-27 11:09                     ` Nicolas Goaziou
2013-07-28  8:36                       ` Jambunathan K
2013-07-28  8:54                         ` Jambunathan K
2013-07-28 11:16                         ` David Maus
2013-07-28 11:22                         ` Nicolas Goaziou
2013-07-29  6:59                           ` Jambunathan K
2013-11-16 15:16       ` Michael Brand
2013-11-16 20:43         ` Nicolas Goaziou
2013-11-17 11:06           ` Michael Brand
2013-11-17 11:46             ` Nicolas Goaziou
2013-11-17 11:51               ` Michael Brand

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

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

  git send-email \
    --in-reply-to=87r4emdl2a.wl%dmaus@ictsoc.de \
    --to=dmaus@ictsoc.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \
    --cc=ndokos@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.