Subject: bug#55429: 27.1; browse-url-of-dired-file fails to open file with '#' character

From: Ivo Tadeu <[email-masked]>
Date: Sun, 15 May 2022 10:33:46 -0300

When you use W in a dired buffer to open a file with the '#' character,
the file doesn't get opened. In my limited testing, the problem appears 
to be in the function `browse-url-file-url':

(browse-url-file-url "/home/ivo/tmp/file with spaces.txt")
  => "file:///home/ivo/tmp/file%20with%20spaces.txt"

(browse-url-file-url "/home/ivo/tmp/file with #.txt")
  => "file:///home/ivo/tmp/file%20with%20#.txt"

When I use xdg-open directly with these urls, the second one will
fail. It appears that the '#' should also be percent-encoded.

Tested with emacs -Q

In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, 
cairo version 1.16.0)
  of 2021-03-27, modified by Debian built on x86-conova-01
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)