0

I copy-paste Gedit-hash (#) in a part of filepath into internet browser to read PDF file unsuccessfully: no file found with Gedit-hash symbol. Inputing there directly the hash symbol from the keyboard is consireded correct. Copy-pasting the gedit-hash to Vim shows Ascii 035 correctly, also tested on the ASCII tool here. Example filepath misinterpreted in Internet browser where # expands to %23 wrongly

/home/masi/Documents/Edition.pdf#page=605

Do

  1. Copy the filepath to Gedit
  2. Copy the filepath from Gedit
  3. Paste the filepath to any internet browser
  4. Output: # symbol is expanded to %23

Methods inserting filepath which are correctly interpreted

  • type hash directly to the internet browser field

OS: Debian 8.7
Internet browsers: Google Chrome 58.0.x, Firefox latest

2

UNIX filenames are not URLs.

You can see that '#' is not interpreted in unix filenames, but it is in URLs.

$ ls '/home/masi/Documents/Edition.pdf#page=605'
ls: cannot access '/home/masi/Documents/Edition.pdf#page=605': No such file or directory
$ curl '/home/masi/Documents/Edition.pdf#page=605'
curl: (3) <url> malformed
$ curl 'file:///home/masi/Documents/Edition.pdf#page=605'
curl: (37) Couldn't open file /home/masi/Documents/Edition.pdf

Firefox is applying the correct escaping, to protect the filename character # from being interpreted as delimiting a fragment in the URL.

  • How can you prevent such a behaviour? I want to use my internet browser to read documents. – Léo Léopold Hertz 준영 Jun 13 '17 at 13:50
  • @LéoLéopoldHertz준영 Use URLs. – sourcejedi Jun 13 '17 at 13:51
  • Documents are in my filesystem. – Léo Léopold Hertz 준영 Jun 13 '17 at 13:51
  • 1
    @LéoLéopoldHertz준영 file:/// URLs. – sourcejedi Jun 13 '17 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.