GNU bug report logs -
#40241
26.1; browse-url, needs to % hex hex encode the hash char
Previous Next
Reported by: larice <larice <at> vidisys.de>
Date: Thu, 26 Mar 2020 15:31:01 UTC
Severity: normal
Tags: notabug
Found in version 26.1
Done: Noam Postavsky <npostavs <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 40241 <at> debbugs.gnu.org (full text, mbox):
> Dear Maintainers,
>
> I couldn't open a link in org mode, which happened
> to contain a hash char #.
> A search for the culprit revealed usage of this
> (setq url (browse-url-encode-url url))
> in several functions,
> for example in browse-url-firefox in file browse-url.el
>
> This function looks like:
>
> (defun browse-url-encode-url (url)
> "Escape annoying characters in URL.
> The annoying characters are those that can mislead a web browser
> regarding its parameter treatment."
> ;; FIXME: Is there an actual example of a web browser getting
> ;; confused? (This used to encode commas, but at least Firefox
> ;; handles commas correctly and doesn't accept encoded commas.)
> (browse-url-url-encode-chars url "[\")$] "))
>
> I suggest to add the char '#' to the second argument of the
> browse-url-url-encode-chars invocation to fix the nuisance.
I've to correct myself, and to withdraw my suggestion.
The '#' char has special significance in rfc3986 and can't be
that easily % hex'ified.
My issue is more precisely the following.
I've URLs for the search engine of "murata" which look like:
http://www.murata.com/en-global/products/productdetail?partno=GRM21BR61E226ME44#
At first sight this looks well, but note the trailing '#'.
When I enter this interactively into firefox, then it works.
If I use %23 instead, it works too.
If I pass the URL on the firefox command line, then only the %23 variant works.
If I use such an URL in a org mode file, either with # or with %23,
then this URL gets un-hexlified to the '#' variant somewhere in
org-mode, is then passed to `browse-url-firefox', which passes it
unmodified to the command line of a firefox invocation.
But that's the variant which doesn't work for firefox.
Now this is too exotic, and I simply withdraw my `bug' report.
I don't think it is worth the time,
neither is it easy to exactly state whats wrong here at all.
Perhaps it is the part of org mode which
un-hexlifies the URL. I suppose it shouldn't.
Then I could have put a %23'fied URL into the org file.
As this case is exotic and very specific,
I simply add an exception rule to `browse-url-browser-function'
like this
(defun my-browse-url-generic (url &optional new-window)
(browse-url-generic (browse-url-url-encode-chars url "#") new-window))
(setq browse-url-browser-function
'(("murata.*#$" . my-browse-url-generic)
("." . browse-url-generic)))
and be done with it.
Sorry for having wasted your time.
Best Regards
Robert Larice
This bug report was last modified 5 years and 140 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.