SUMMARY Okular will not open file if "#" is in the filename or file path when "Open with" method is used. Okular will open files which have "#" in filename or file path when the Open command in the menu is used. STEPS TO REPRODUCE 1. Select a PDF file that opens in Okular. 2. Rename file by inserting a "#" anywhere in its file name. 3. Right click on file, select "Open with", select Okular. 4. Okular fails to open file and reports an "Error - Okular ? Could not open file:...". Note filename truncates at "#". 5. Create folder which has "#" in its name. 6. Rename PDF file by removing "#" from filename. 7. Move renamed file to newly created folder (has "#" in its name). 8. Right click on file, select "Open with", select Okular. 9. Okular fails to open file and reports an "Error - Okular ? Could not open file:...". Note path name truncates at "#". OBSERVED RESULT Okular fails to open file which has a "#" in its filename or file path. EXPECTED RESULT Okular should open file which has a "#" in its filename or file path. SOFTWARE/OS VERSIONS Windows: Windows 10 build 1909 macOS: Linux/KDE Plasma: (available in About System) KDE Plasma Version: KDE Frameworks Version: Qt Version: ADDITIONAL INFORMATION Okular will open files with "#" in filename or "#" in file path if Open menu command is used.
*** Bug 422856 has been marked as a duplicate of this bug. ***
If the document URL contains a #, Okular tries to focus the page specified by the number following the #. Of course this fails if # is part of the actual URL. It was already suggested to interpret only #page=1234 as page number command, currently Okular expects #1234 which doesn’t match the behavior of other applications. There is another older bug report about the original issue in this bug report, but I don’t find it right now.
(reposting from one of the duplicate bugs) I just tested on (Gentoo) Linux, okular 1.9.3 (I see 1.10 is out) and it works fine. I also tested 1.9.2 (latest available in the Windows Store) in a Wind 10 guest in VirtualBox, and it also works fine whether # is at the beginning or in the middle of the file name. What version of Windows are you on? Might the behavior depend on whether what is after the # are just digits, or non-digit alpha characters.
Created attachment 129709 [details] attachment-8302-0.html OS Name Microsoft Windows 10 Home Version 10.0.18363 Build 18363 Okular version 1.9.2. It does not matter whether the characters following the "#" are blank, numbers or letters. As soon as Okular parses to the "#" it stops parsing and because the file name is incomplete, the file cannot be opened. On Fri, Jun 26, 2020 at 3:59 PM Jack <bugzilla_noreply@kde.org> wrote: > https://bugs.kde.org/show_bug.cgi?id=418758 > > Jack <ostroffjh@users.sourceforge.net> changed: > > What |Removed |Added > > ---------------------------------------------------------------------------- > CC| > |ostroffjh@users.sourceforge > | |.net > > --- Comment #3 from Jack <ostroffjh@users.sourceforge.net> --- > (reposting from one of the duplicate bugs) I just tested on (Gentoo) > Linux, > okular 1.9.3 (I see 1.10 is out) and it works fine. I also tested 1.9.2 > (latest available in the Windows Store) in a Wind 10 guest in VirtualBox, > and > it also works fine whether # is at the beginning or in the middle of the > file > name. What version of Windows are you on? > > Might the behavior depend on whether what is after the # are just digits, > or > non-digit alpha characters. > > -- > You are receiving this mail because: > You reported the bug.
Have you diagnosed what is happening in a debugger, or are you assuming? In my case, on both Windows and Linux, it is able to open a file with # in the name, using the File/Open dialog, or when launced by command line. so there is likely something different between our systems. What locale (country/language) are you using? I have en_US.UTF-8, although I have no idea if it matters. (Note that when replying by email, you can remove what you are replying to, as it is already posted to the bug.)
I also have similar problem that reported in bug 423490. Appears only if you click on a document in Explorer or use "Open with". From cli doesn't work the same way. Opening from the Okular menu works correctly.
I can now confirm this. I'll guess it has something to do with how Windows Explorer passes the file name to Okular, and how Okular then processes it. If I have two pdf files name "test#test.pdf" and "test" (no extension) and try to open the first - it does open the second. This supports the idea that the file name Okular tries to open gets truncated at the first #. Opening from Explorer with Edge works. Opening on Linux with Dolphin does work; I haven't tried other linux file managers.
Maybe Explorer passes the # as #, and Dolphin passes it as %35? Code is here: https://invent.kde.org/graphics/okular/-/blob/master/part.cpp#L1736
I haven't had time to try anything on Windows yet, but by creating a shell script called okular, and placing it earlier in my path, and invoking it by clicking on the file in Dolphin, it seems to not encode the # in any way in the invokation. (I just had the script pass $@ through "od -c" and append it to a file.) What I'm not sure of is whether okular then tries to open that as a file or URL.
*** Bug 432023 has been marked as a duplicate of this bug. ***
Have you tried with a newer Okular version? At least this works fine for me on Windows11 https://imgur.com/a/Q9WjB8i (sorry for the potato quality video)
Created attachment 145721 [details] attachment-31156-0.html The bug is fixed and the issue is resolved. Thank you very much. On Fri, Jan 21, 2022 at 6:31 AM Albert Astals Cid <bugzilla_noreply@kde.org> wrote: > https://bugs.kde.org/show_bug.cgi?id=418758 > > Albert Astals Cid <aacid@kde.org> changed: > > What |Removed |Added > > ---------------------------------------------------------------------------- > Resolution|--- |WAITINGFORINFO > Status|REPORTED |NEEDSINFO > CC| |aacid@kde.org > > --- Comment #11 from Albert Astals Cid <aacid@kde.org> --- > Have you tried with a newer Okular version? > > At least this works fine for me on Windows11 https://imgur.com/a/Q9WjB8i > (sorry > for the potato quality video) > > -- > You are receiving this mail because: > You reported the bug.