emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Spaces in bare URLs?
@ 2020-03-18  2:14 Mark E. Shoulson
  2020-03-18  9:43 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Mark E. Shoulson @ 2020-03-18  2:14 UTC (permalink / raw)
  To: org-mode mailing list

[-- Attachment #1: Type: text/html, Size: 2507 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Spaces in bare URLs?
  2020-03-18  2:14 Spaces in bare URLs? Mark E. Shoulson
@ 2020-03-18  9:43 ` Nicolas Goaziou
  2020-03-18 20:25   ` Mark E. Shoulson
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2020-03-18  9:43 UTC (permalink / raw)
  To: Mark E. Shoulson; +Cc: org-mode mailing list

Hello,

"Mark E. Shoulson" <mark@shoulson.com> writes:

> So, in the "new" org-mode, we've done away with standard
> percent-encoding of URLs, in favor of a more... idiosyncratic method
> using backslashes.

...

> So... what is one supposed to do about spaces in URLs? 
> When they're in [[link format]], with or without a description, it's no problem, but org-mode has a long tradition of support for "bare" URLs too.  We're used to being able to type a URL or other link format
> and have it work, right?  And that doesn't seem (to me) to be a thing
> that we'd want to abandon.
>
> In org-mode 9.1.9, I can type "info:elisp#Syntactic%20Font%20Lock" and it'd work.  (Maybe not the greatest example, since %-encoding is seen more with http-based URIs, but still).  The
> percent-encoding is well-established and reliable

Unfortunately, that wasn't reliable. As it is not idempotent, you can
never know how many times you need to decode an URL before sending it.

Imagine I have a file called "foo%2000.org". Should I link it
file:foo%252000.org or file:foo%2000.org? You prefer the former. But
what if I forget about the rules?

Now, what Org is expected to do with file:foo%252000.org ? Decoding it
unconditionally lead to bug reports scattered throughout the years. So
did ignoring encoding.

The thing is URL encoding is not for human consumption, i.e., we
shouldn't have to deal with it.

> and you can *count* on it when nothing else works, because you can
> always fall back on plain ascii.  

Current backslash escaping is also well established, and as much
ASCII-like as anyone would expect.

> But that won't work in org-mode 9.3.6.  Nor will
> "info:elisp#Syntactic Font Lock" or "info:elisp#Syntactic\ Font\ Lock"
> or any other variant I've tried, short of putting it inside [[]]s or
> <>s (in other words, no longer using a bare URL).

True, but that's a minor annoyance.

You apparently prefer to encode a URL manually, replacing each space
with %20 (and other characters with more baroque escape sequences),
rather than adding <...> (or [[...]]) around it and be done with it.
Perhaps this one was the bad idea, after all?

> I think dropping percent-escaping of URLs was a bad idea, in terms of breaking past usage and lack of consistency with the standard used for URLs everywhere else.  But I don't know what impelled the
> decision to drop it, so I might well be missing something important.  
>
> At any rate, it does leave a hole in what org-mode can do, a thing it used to be able to do and can't anymore.  Is there a right way to do
> this?  (without using delimiters.)

It was not a bad idea. It is not perfect, but it is still better than
what we had, because it is unambiguous.

You can still use <...> delimiters, or, as you noted, [[...]].
I understand it breaks your workflow, but there is no loss of feature,
and no hole either: you can still link to URL with spaces in it.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Spaces in bare URLs?
  2020-03-18  9:43 ` Nicolas Goaziou
@ 2020-03-18 20:25   ` Mark E. Shoulson
  0 siblings, 0 replies; 3+ messages in thread
From: Mark E. Shoulson @ 2020-03-18 20:25 UTC (permalink / raw)
  To: org-mode mailing list

On 3/18/20 5:43 AM, Nicolas Goaziou wrote:
> Hello,
>
> "Mark E. Shoulson" <mark@shoulson.com> writes:
>
>> So... what is one supposed to do about spaces in URLs?
>> When they're in [[link format]], with or without a description, it's no problem, but org-mode has a long tradition of support for "bare" URLs too.  We're used to being able to type a URL or other link format
>> and have it work, right?  And that doesn't seem (to me) to be a thing
>> that we'd want to abandon.
>>
>> In org-mode 9.1.9, I can type "info:elisp#Syntactic%20Font%20Lock" and it'd work.  (Maybe not the greatest example, since %-encoding is seen more with http-based URIs, but still).  The
>> percent-encoding is well-established and reliable
> Unfortunately, that wasn't reliable. As it is not idempotent, you can
> never know how many times you need to decode an URL before sending it.

Well, any form of escaping is pretty much by definition not idempotent.  
That's the whole point of escaping: you have something you can't say, so 
you make some magical character that changes the meaning of nearby 
characters so you can describe it in characters you can't say.  And the 
price you pay is that now you can no longer say your magical character 
plain, you have to use another form of escaping to express it (usually 
the same form as the others).  It's like how it's impossible to compress 
*every* file to make it smaller and some even have to get bigger.  The 
pigeonhole principle shows _why_ it isn't possible, and escaping shows 
(one way) _how_ it isn't: say you use high-ascii bytes to represent 
common strings or something.  How do you represent them when they're 
really in the text?  You have to escape them... which makes your file 
*larger*.

> The thing is URL encoding is not for human consumption, i.e., we
> shouldn't have to deal with it.
This is a good point.  While on one hand it makes sense to be able to 
type URLs that have spaces in them without spaces, it is sort of 
ridiculous to expect users feel "natural" about typing "%20" instead.  
(I think this is why the specs say that you can also escape a space by 
using the "+" character, in order to make it easier for this most-common 
of characters... but that weird exception has caused all kinds of 
hassles in code from that day to this; I know from my own experience.)
>> and you can *count* on it when nothing else works, because you can
>> always fall back on plain ascii.
> Current backslash escaping is also well established, and as much
> ASCII-like as anyone would expect.

Really?  As ASCII-like as I could expect?  What if my URL is 
https://he.wikipedia.com/שלום_עליכם ?  If I am in some backward 
environment (still all too common) where all I can rely on is ASCII, I 
can percent-encode the UTF-8 representation and it will work.  Can we 
count on being able to backslash-quote things clear down to ASCII?  I 
don't see a way in the docs I've seen.

>> But that won't work in org-mode 9.3.6.  Nor will
>> "info:elisp#Syntactic Font Lock" or "info:elisp#Syntactic\ Font\ Lock"
>> or any other variant I've tried, short of putting it inside [[]]s or
>> <>s (in other words, no longer using a bare URL).
> True, but that's a minor annoyance.
>
> You apparently prefer to encode a URL manually, replacing each space
> with %20 (and other characters with more baroque escape sequences),
> rather than adding <...> (or [[...]]) around it and be done with it.
> Perhaps this one was the bad idea, after all?

Yes, using <>s works, as does [[]].  And yes, I do have to concede that 
claiming it should be "natural" for a user to hand-escape things with 
%20s is sort of ridiculous.  Having to reprocess all old org-files for 
such a common notation still seems like more trouble than it was worth, 
but then you didn't ask me (and you were QUITE RIGHT not to do so!)  I 
guess a converter-script should also enclose bare URLs in <>, at least 
if they have spaces or other whitespace.

Still don't know about org-protocol and store-link, because I'm lazy.  
Right now, at least some of the emacsen I'm working with still use 
org-9.1.9, so I haven't converted anything.

~mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-18 20:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-18  2:14 Spaces in bare URLs? Mark E. Shoulson
2020-03-18  9:43 ` Nicolas Goaziou
2020-03-18 20:25   ` Mark E. Shoulson

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