GNU bug report logs - #50435
27.2; browse-url-encode-url not encoding spaces

Previous Next

Package: emacs;

Reported by: Howard Melman <hmelman <at> gmail.com>

Date: Mon, 6 Sep 2021 18:07:01 UTC

Severity: normal

Found in version 27.2

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50435 in the body.
You can then email your comments to 50435 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#50435; Package emacs. (Mon, 06 Sep 2021 18:07:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Howard Melman <hmelman <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 06 Sep 2021 18:07:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Howard Melman <hmelman <at> gmail.com>
To: GNU Emacs <bug-gnu-emacs <at> gnu.org>
Subject: 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50435; Package emacs. (Mon, 06 Sep 2021 19:15:02 GMT) Full text and rfc822 format available.

Message #8 received at 50435 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Howard Melman <hmelman <at> gmail.com>
Cc: 50435 <at> debbugs.gnu.org
Subject: Re: bug#50435: 27.2; browse-url-encode-url not encoding spaces
Date: Mon, 06 Sep 2021 21:14:52 +0200
On Sep 06 2021, Howard Melman wrote:

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

It's documented in the url manual ((url) URI Encoding).

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50435; Package emacs. (Tue, 07 Sep 2021 15:48:02 GMT) Full text and rfc822 format available.

Message #11 received at 50435 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Howard Melman <hmelman <at> gmail.com>
Cc: 50435 <at> debbugs.gnu.org
Subject: Re: bug#50435: 27.2; browse-url-encode-url not encoding spaces
Date: Tue, 07 Sep 2021 17:47:11 +0200
Howard Melman <hmelman <at> gmail.com> writes:

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

browse-url-url-encode-chars was documented to take a string of
characters to translate, but used it as a regexp.  I've now fixed the
documentation and `browse-url-encode-url'.

> 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've now fixed this in Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 28.1, send any further explanations to 50435 <at> debbugs.gnu.org and Howard Melman <hmelman <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 07 Sep 2021 15:48:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 06 Oct 2021 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 201 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.