-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
when LANG="" file with "ö" in name cannot be opened #11214
Comments
This is definitely a qt issue. There isn't much we can do about this. Obviously easy fix is to not use non-ascii characters in your file name or make sure your LANG is set. |
Turns out, this is a Qt issue, but the problem is in fact a bit more complex. "Passw?rter.kdbx" means a Latin1 string is being interpreted as UTF-8 here. However, simply running
isn't a good problem demonstration. The following Python snippet is a more stable test case: import subprocess
subprocess.Popen([b'keepassxc-cli', b'ls', 'Passwörter.kdbx'.encode('iso-8859-1')],
env={'LANG': ''}).wait() This is where we parse the command line arguments: https://github.com/keepassxreboot/keepassxc/blob/develop/src/cli/keepassxc-cli.cpp#L194 I believe that for (int i = 0; i < argc; ++i) {
arguments << QString(argv[i]);
} is indeed wrong. This should at least be I think defaulting to UTF-8 is a sane assumption for most Linux systems, but if your input encoding is something else, this will obviously fail. To fix this, we'd need to parse |
yeah, agree. looks, like output is latin1, where the terminal expects utf8
terminal's input encoding is utf8, even with LANG="" as setting this in front of command only change it for the command, not the terminal
mind, this is the qt6 docs, qt5 is different, and actually fromLocal8Bit and fromUtf8 do different things.
small test program to try a few things. running this program with
line 1: terminal is consistent with encoding of input given and output expected |
This is not just the terminal output, but first and foremost the file name. File names are always UTF-8 on Linux, so using a Latin1 string is wrong in any case. When I QDebug my QLocale, it always says "Latin1", even when it's actually UTF-8. I also couldn't find any difference in behaviour between |
Christian, try to execute the executable like this LANG=de_DE.UTF-8 executable args Tell me if it works, I had the same problem in Qt and fixed it by using LANG=C in another situation. Good luck mate |
This works, and it is my default. It just stumbled over the problem by accident, and thought I ccould report it. |
Overview
When LANG is set to "" file "Passwörter.kdbx" cannot be opened
Steps to Reproduce
Expected Behavior
file can be opened
Context
Not 100% sure, but to my experience, LANG should only affect the used output lanugage, and should not affect the encoding that is used for interpreting given arguments, eg.:
GUI is affected in same way
The text was updated successfully, but these errors were encountered: