emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Encoding Problem in export?


From: Nick Dokos
Subject: Re: [O] Encoding Problem in export?
Date: Wed, 24 Jul 2013 05:39:55 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Nicolas Goaziou <address@hidden> writes:

> My guess is that your URL is encoded in the original buffer already. Try
> to use M-x visible-mode to see what is the real URL. If you see
> "http://example.de/?idprop%3D222";, it probably means that
> `org-link-escape' is a bit too zealous (BTW why don't this function rely
> on `url-encode-url'?)

FWIW, I think this is correct: using org-insert-link runs
org-link-escape with the default org-link-escape-chars which includes
'='. 

I don't know why '=' is included, so I looked to see whether deleting it
from org-link-escape-chars would cause problems.  Looking at the call
sites, org-link-escape is called from:

o org-mobile.el but with its own set of escape chars, so that's no
  problem.

o ob-tangle.el from org-babel-tangle-comment-links, which in turn is
  called (twice) from org-babel-expand-noweb-references. The default
  org-link-escape-chars is used, so any '=' would get escaped, but
  whether leaving it out would cause any problems, I don't know.

o org-docview.el from org-docview-export with the default escape chars.
  Again, I don't know if leaving '=' out would cause any problems.

o org.el from org-make-link-string (thrice) with the default escape
  chars and another three times from org-open-at-point, once for a
  "mailto" link and another two times to open an http/https/ftp/news/doi
  url but with a smaller set of escape chars that does not include '='.

o org-make-link-string is itself called from a bunch of places:
  org-capture.el, org-clock.el, org.el, org-protocol.el, org-w3m.el.
  I didn't chase it down through these.

I tried a ``git blame'' to see whether the '=' was added for some
reason, but it looks as if it's been there ab initio.

Maybe the thing to do is to delete '=' from org-link-escape-chars and
see what problems arise.

But I did find that '%' was originally in org-link-escape-chars and
David Maus hardcoded it (commit 139cc1d4), so that it is *always*
escaped. I assume there is a good reason for that, but if so,
url-encode-url might not be enough - afaict, it leaves '%' signs alone:

,----
| (setq url "http://www.google.org/foo=bar 30%=2")
| "http://www.google.org/foo=bar 30%=2"
| 
| (org-link-escape url)
| "http://www.google.org/foo%3Dbar%2030%25%3D2";
| 
| (url-encode-url url)
| "http://www.google.org/foo=bar%2030%=2";
`----

-- 
Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]