Bug 440641

Summary: Okular Windows filename encoding issue
Product: [Applications] okular Reporter: Gerald Combs <gerald>
Component: generalAssignee: Okular developers <okular-devel>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version: 21.04.3   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Gerald Combs 2021-08-05 18:25:32 UTC
SUMMARY


STEPS TO REPRODUCE
1. Log into a Windows machine with the code page set to 437.
2. Download "Wireshark User’s Guide.epub" from https://www.wireshark.org/download/docs/.
3. Try to open the file in Okular.

OBSERVED RESULT

Okular displays the error "Could not open file:///C:/path/to/Wireshark User's Guide.epub. Error while opening the EPub document." 

EXPECTED RESULT

Okular should be able to open a file with U+2019 RIGHT SINGLE QUOTATION MARK in its name, such as "Wireshark User’s Guide.epub". The file opens just fine if I replace the curly quote with an apostrophe (').

SOFTWARE/OS VERSIONS
Windows: Server 2019 1809

ADDITIONAL INFORMATION

This might be due to the fact that Qt mangles command line arguments with extended characters on Windows:

https://bugreports.qt.io/browse/QTBUG-46118
https://github.com/qt/qtbase/blob/6.2/src/corelib/kernel/qcoreapplication.cpp#L172

We worked around this in Wireshark by fetching the wide version of the argument vector and converting it to UTF-8 on Windows:

https://gitlab.com/wireshark/wireshark/-/blob/0a9ef601/ui/qt/main.cpp#L562