bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#50435: 27.2; browse-url-encode-url not encoding spaces


From: Howard Melman
Subject: bug#50435: 27.2; browse-url-encode-url not encoding spaces
Date: Mon, 6 Sep 2021 14:06:33 -0400

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





reply via email to

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