unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50435: 27.2; browse-url-encode-url not encoding spaces
@ 2021-09-06 18:06 Howard Melman
  2021-09-06 19:14 ` Andreas Schwab
  2021-09-07 15:47 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 3+ messages in thread
From: Howard Melman @ 2021-09-06 18:06 UTC (permalink / raw)
  To: 50435

I may be misunderstanding something, but
browse-url-encode-url does not encode spaces.

    (browse-url-encode-url "foo bar")

returns "foo bar" and I think it should return "foo%20bar"

It looks like a simple typo in browse-url-encode-url since it calls:

  (browse-url-url-encode-chars url "[\")$] "))

I think the space should be before the ], but from what I can 
tell it's been that way since 2012.

Also browse-url-encode-url is used in several browser
specific browse-url functions like browse-url-netscape and
browse-url-firefox but not in
browse-url-default-windows-browser and
browse-url-default-macosx-browser.  Is this intentional?
I'm on a mac (using the macport) and it seems frustrating.

I'm trying to do something like this:

  (let ((url "https://www.dndbeyond.com/search?q=%s")
        (str (browse-url-encode-url (buffer-substring-no-properties (region-beginning) (region-end)))))
    (browse-url (format url str))))

Maybe I'm supposed to use something else?  Like
url-hexify-string (which seems to work)?  I found it
frustrating that there's no mention of any of this stuff in
the elisp manual.  I'm not sure which is the preferred
mechanism.  I feel like browse-url.el should call
url-hexify-string but it doesn't (probably for historical
reasons) though it does call url-unhex-string once.

In GNU Emacs 27.2 (build 1, x86_64-apple-darwin18.7.0, Carbon Version 158 AppKit 1671.6)
of 2021-03-27 built on Traviss-Mac.local

-- 

Howard





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

end of thread, other threads:[~2021-09-07 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-06 18:06 bug#50435: 27.2; browse-url-encode-url not encoding spaces Howard Melman
2021-09-06 19:14 ` Andreas Schwab
2021-09-07 15:47 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).