Accented characters not being displayed
KeePass Command Line Interface
Brought to you by:
hightowe,
perlsaiyan
Hi!
I just discovered that nice little utility for managing my passwords!
I noticed that many characters from the french language are not being displayed like é, è, à, etc.
See below:
Provide the master password: ***********************
KeePass CLI (kpcli) v4.0 is ready for operation.
Type 'help' for a description of available commands.
Type 'help <command>' for details on individual commands.
kpcli:/Root> ls
=== Groups ===
Cl�s de licence/
G�n�ral/
The groups should read "Clés de licence/" and "Général/"
I am using Fedora 39 which currently has version 4.0-1.
I don't believe that this is a kpcli bug, at least not directly. To support that assertion, you can see kpcli doing the right thing on my Linux Mint desktop:
I suspect an issue with utf8 and perl and your terminal. It will likely be difficult to troubleshoot from a distance, but perhaps comparing your installed modules to mine will be helpful (this is a long list, sorry...):
The Term::ReadLine module used is the first place that I would start, but honestly I don't quite see how that could cause it. There could be some perl default UTF-8 behavior that is compiled differently in Fedora than in Mint...
I hope this helps. Sorry that I don't have a better answer.
Here are my installed modules, in case that's useful:
It may also be helpful to look at your LANG environment variable setting:
You could also try running kpcli underneath luit, to try to help understand and isolate the problem:
If luit solves the problem for you, the the issue is definately in your terminal and/or environment.
Wow, thanks man! running kpcli through luit solved the problem. So I'll add that to my current bash alias for now and eventually try to troubleshoot my terminal and/or environment (for now, my $LANG environment variable is
fr_CA.UTF-8which seems to make sense since I'm a French-Canadian).Sorry I'm a little new to bug reporting (and I'm not a developer) so I'm not sure if I should open a new ticket here or with the
perl-Clipboarddevelopper for the following:I noticed that the copy to clipboard commands (xp, xu, xw, etc.) don't work. I have
perl-Capture-Tinyandperl-Clipboardinstalled. I saw thatperl-Clipboardrequiredxclipas a dependency.xclipdoes not work on Wayland (I'm using Fedora 39 with Gnome 45.5). The equivalent of xclip under Wayland would bewl-copyfrom thewl-clipboardpackage.Thank you!
Patrick - The Perl Clipboard module is under active development. The most recent Changelog entry is from just 3 days ago: https://metacpan.org/dist/Clipboard/changes
As such, there is a good change that the author, Ryan King rking@panoptic.com, would consider adding support for Wayland.
The code is hosted on GitHub and you could open an issue here: https://github.com/shlomif/Clipboard/issues
Today, and by looking at the source code, it does appear that Wayland is not supported: https://metacpan.org/release/SHLOMIF/Clipboard-0.29/source/lib/Clipboard.pm
However, given the nice code organization of this module, with support for both Xsel and Xclip, adding a driver for wl-clipboard would probably not be very difficult. Heck, I'd even be willing to pitch in and help Ryan if needed, although I don't have anything running Wayland.
Last edit: Lester Hightower 2024-04-10
I went ahead and opened an issue: https://github.com/shlomif/Clipboard/issues/13
I setup a Fedora-39 environment in which to code wl-clipboard support into Clipboard, and after getting that done it all appears to be unecessary. Instead, I just installed xclip and it worked...
And then running that in Fedora 39 under Wayland:
I therefore don't know how to replicate the clipboard problem that you reported. It seems that there isn't one, other than perhaps you needing to install xclip...?
I do have xclip installed (it was installed as a dependency for perl-Clipboard).
And it looks like xclip is not supposed to be working on Wayland:
xclip on wayland - Google Search
Does not work with wayland · Issue #62 · astrand/xclip · GitHub
Is it possible that your Fedora 39 environment is running under Xwayland?
Hi Patrick -
Yesterday was the first time that I ever touched Fedora 39 or Wayland. I am not 100% sure how to answer your question about XWayland, but on the login screen I am using the "GNOME" option, not either of the two that end with "... on Xorg" (see attached) which I believed means Wayland... How can I know for sure?
This leads me to believe that the Fedora-39 osboxes.org VM that I grabbed yesterday is indeed setup to use Xwayland, which would explain why xclip works:
I am not sure how to change that (probably will go Google it now) and am also unsure what sort of castrophe it may cause for integration with VirtualBox.
Googling did not help me much... I do believe that I figured out how to stop XWayland from loading, but when I instituted it the GNOME desktop would then not start at all.
What I did is found here: https://www.reddit.com/r/gnome/comments/xa18en/how_to_disable_xwayland_completely/
I edited via "systemctl --user edit org.gnome.Shell@wayland.service" and added:
which I believe worked to stop XWayland from loading, but then the user cannot get to a working GNOME desktop, and so I was forced to roll it back.
Despite not being able to disable XWayland, I was able to add wl-clipboard suport to Clipboard. I re-opend the related issue and submitted a pull request:
Hey thanks a lot man! I think that will be helpful for many people as most desktops are gradually moving to Wayland, including Linux Mint that recently started an experimental Wayland session ;)
Damn! It looks like running kpcli through luit did NOT solved the problem. I accidentally ran keepassxc-cli through another alias and thought it was kpcli... Anyway, thank you very much for you time, I'll try troubleshoot my environment or terminal later on.
After a little more research, I am curious to know if the issue that you reported exists only on entries created in another program (like keepassxc) or if it also appears on entries that you create in kpcli? If it's the former only, then it may be that the character encoding that was used for adding the entries does not match what your terminal is using. https://github.com/keepassxreboot/keepassxc/issues/2413
Yes, it looks like there is a difference between data added by KeePassXC and data added by kpcli. I made some tests and here are the results.
Entries made with KeePassXC
When I use kpcli to access my real password database that was entirely created with KeePassXC, I get the following behaviour:
Entries made with kpcli
To test entries created with kpcli, I created a test.kdbx database with kpcli and never let KeePassXC touch it. The results are better overall but stil a few problems:
kpcli:/Root/Collège>instead ofkpcli:/Root/Collège>.From this, I suspect that you may have found multiple problems...
Let me start with just one possible one and that is that the LANG setting that KeePassXC is pickup up from your system-wide settings differs from that given in your terminal that kpcli is given. That could happen if you are changing your LANG in your ~/.bashrc, for example.
Do these values all match for you?
Related, if you launch KeePassXC from a terminal, does the behavior differ?
The matter of character encoding here is fairly complex because of all of the layers involved. In your GUI environment, there is Wayland, Gnome/GTK, and then finally Qt, because KeePassXC is written with the Qt GUI toolkit (ala. KDE).
Hi Lester,
As for my ~.bashrc, I checked and did a few searches in it (LANG, utf, etc.) and found nothing that seems to change my LANG. I also tried to disable all the default things that Fedora puts in it (since there is some stuff in there that I can't quite understand) and it didn't solve the problem.
As for my LANG values, they seem to match:
KeePassXC behaves the same whether I open it from Gnome or from gnome-terminal.
I also tried using kpcli in a tty with Ctrl+Alt+F3 (therefore completely bypassing Gnome if my understanding is correct) and it did not solve the problem.
I also tried to open my database with KeePassXC on Windows and everything is ok.
I tried to add an entry with a bunch of accented characters with kpcli to my real password database (which was entirely made with KeePassXC). That entry is then not displayed correctly in kpcli but is displayed correctly in KeePassXC.
It looks like my list of installed modules includes a utf8 module,
utf8: 1.25, which does not appear in your list. I know nothing about perl modules so I'm just guessing at this point...Because I am unable to replicate the problem. could you create and provide a file that I can use to test with?
Patrick - I discovered a couple of things that I want to share.
Have a look at this:
Take note that the "saveas" command first saves and then loads the file.
Now, check this out:
In the second case (KDBXv3) the file is saved and loaded with File::KeePass. In the first case (KDBXv4), it is saved and loaded with File::KDBX.
No good answers, but at least I think that I have a place to look now. The author of File::KDBX is a great guy who has been responsive to me in the past. I may ask him his thoughts as he may have dealt with this prior and save me a ton of time.
And FYI, the tab completion and path prompt problem happens in both cases after the files are loaded, but it does not occur on new entries that are not saved. And so, I think there may be some character encoding/decoding problems happening on load in both cases, but perhaps it is less severe in the case of File::KeePass, but I am not sure yet.
Nice! I'm happy to see that the problem is getting more and more isolated. Since you were able to replicate the problem, I assume that you don't need me to provide a test file anymore but if you need anything, just give me a sign.
I'm not used to contributing bug reports... I thought it was very interesting and you are definitely very dedicated to your project. Honestly, I was a little worried about waisting your time in the event it would have turned out to be my computer's problem.
And since both clipboard and accented characters issues seem to be coming from dependencies, I hope that all of this will benefit other projects as well.
Anyway, have a great rest of you day and do not hesitate if you need any other feedback!
Patrick - Charles (the author of File::KDBX) was quick to respond and he provded some great information. Things are not 100% working yet, but they are much improved.
If it's not too much trouble, would you please make and send a small testable kdbx file, made in your environment with KeePassXC? I want to be sure that your files, from your locale, also test well. All of my files are all built in the en_US.UTF-8 locale.
Just make a small file that has a few groups and entries with names and values that include characters that you're having trouble with, give it a trivial password like "test" or something, and attach the file to a reply here.
Thanks.
Hi Lester,
Is a test file in KDBX4 format made with KeePassXC.
The password is "test"
I tried to include a lot of diversity of French characters and left a few names without them in case the problem persists and you need to
showorcdinto something.Let me know if you need anything else.