-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
[Windows] Encoding problem in password and extra lines #412
Comments
I installed QtPass in Arch Linux and the encoding is OK (creating new password with special chars and decrypting that password with "configurações" in it) |
I have not debugged, but my best guess is that the problem is with these lines in executor.cpp: |
In that respect, UTF-8 has some nice properties. Specifically, it's possible to completely verify a given sequence of bytes, whether it is valid utf-8. Not only that, but any ASCII (7-bit) text is valid, and upper ascii is not. So, if you get something that's not valid UTF-8, it's probably a local encoding. The converse is also almost always true, which is that any text in a local encoding, that uses characters above 127 is not valid UTF-8. For example, according to https://www.w3.org/International/questions/qa-validator-charset-check
This tells me that your proposed solution is in fact not that ugly. |
Although, that being said, |
To quickly debug this I've tried decrypting a file from the password-store manually using gpg on the command line. This already shows broken encoding upon decrypt (gpg -d) for any special chars. Decrypting the file on Linux gpg shows the correctly encoded password (even if this password was previously encrypted on a Windows machine). This leads me to believe that the problem might not lie within QtPass but rather gpg4win as QtPass is just parsing the output of the gpg command in native mode. It could be related to this task on the gpg4win tracker: https://dev.gnupg.org/T2281 |
I don't use gpg4win, rather the simple installer of GnuGP (
https://gnupg.org/ftp/gcrypt/binary/gnupg-w32-2.2.11_20181106.exe). This
issue appears only in QtPass (nor gpg directly or browserpass)
|
Since we (most sensibly) encode text as UTF-8 before encrypting we should assume that the password files contain UTF-8 when decrypting, instead of the current locale encoding. This is the biggest issue on Windows, since it doesn't even officially support locales with UTF-8 encoding. For compatibility, detect if the data is not valid UTF-8 and fall back to Qt's BOM based approach, which provides support for UTF-16 and falls back to current locale encoding. Fixes issue IJHack#412
gpg just decodes the data in the file, it doesn't deal with text encoding, it neither can nor should (the linked gnupg ticket is only about things like status/error messages, help text etc. not the actual data in the file which we care about for this issue). |
And another reminder: this is NOT a Windows-specific issue. It will happen on ANY non-UTF-8 locale. Which a lot of old RedHat 6 and similar installs still use. So some Linux user will be affected as well. |
I'd like to report this issue is still happening on clean (sandbox) Windows 10 with Gpg4Win. |
Hello! I have some passwords that have some extra lines, and QtPass don't handle special chars in panel and in edit box.
i.e: "configurações" turns to be "configurações" in QtPass.
When I use gpg directly from Powershell/command line to save decrypted file, I get the expected text in UTF-8.
--
I created a new password using QtPass. This password contains special chars and I put "configurações" in the extra line. Result:
Pass: "áéÃóúãããããããã"
Extra line: "configurações"
--
Saved in extra line "§" got "§" in panel, edit box and clipboard, just like saved password '§' turns to '§' when copied to clipboard or shown when editing #91
I'm using Windows 10 1803 with QtPass 1.2.3 (and installed gnupg-w32-2.2.9_20180712)
Thanks
The text was updated successfully, but these errors were encountered: