• NetBSD
  • Qt applications can't open files which have special characters in their name

rvp Ok! I don't have LXQt, I'm talking standalone apps.

featherpad file-chooser doesn't see the file, with or without the ticked box.
pcmanfm-qt does see the file.
xpdf also sees the file when the .pdf extension is appended to the file name.

LXQt and featherpad-1.2.0 on Void Linux. All file-choosers see the file, no difference between the applications.
If this is not a general Qt issue I would like to understand what is causing it.

EDIT: https://github.com/tsujan/FeatherPad/discussions/670#discussioncomment-3400803

EDIT 2: If you disable uim do you get the same behaviour.

    pin featherpad file-chooser doesn't see the file, with or without the ticked box.

    Yes. (this would be the nice-looking Fusion QT5 chooser if you don't use the LXQT DE: see pic above)

    pin pcmanfm-qt does see the file.

    Yes, and opens the files too.

    pin LXQt and featherpad-1.2.0 on Void Linux.

    Can files be open by double-clicking?

    • pin replied to this.

      rvp Can files be open by double-clicking?

      Yes! At least in pcmanfm-qt. I need to go back a see if I can do it from the featherpad file-chooser.

      EDIT: Again, if you disable uim do you get the same behaviour.

      rvp BTW, Featherpad 1.2.0 on FreeBSD shows exactly the same behaviour.

      I don't have problems on FreeBSD with the same programs. Both file dialogs show the file and can open it.

      pin EDIT 2: If you disable uim do you get the same behaviour.

      Yes.

        bsduck Yes.

        Yes where? Does pcmanfm-qt stops seeing the file? Does LXQt stops seeing it?
        As you have noticed, not all Qt-apps are affected and the issue is not a general Qt issue. Finding out why certain applications are affected while others are not, is the puzzle we need to solve.

        I mean disabling uim just doesn't change anything to the matter. What works with it still works without it and what doesn't still doesn't.

        • pin likes this.

        @rvp

        Yes! At least in pcmanfm-qt. I need to go back a see if I can do it from the featherpad file-chooser.

        It works also on the featherpad file-chooser. No issues on Void Linux LXQt/FeatherPad.

        @bsduck Thanks! Then uim may be removed from the LXQt meta-package as apparently is doing nothing.

          pin Then uim may be removed from the LXQt meta-package as apparently is doing nothing.

          No, that's not what I mean: it does what we discussed in https://www.unitedbsd.com/d/606-keyboard-dead-keys-dont-work-in-qt-applications so better not remove it as of now, but it does nothing related to the present issue with file names. That being said, there should be another way to have working dead keys in Qt than using uim, because on FreeBSD or Linux I never needed it. The two issues are possibly related.

          • pin replied to this.

            bsduck The two issues are possibly related.

            Most probably. Upstream confirms that uim shouldn't be needed for LXQt to recognize dead keys.

            Ok, so I had to try @nia 's settings, even though they looked a bit strange. So, I changed my .xinitrc
            from

            export LANG=en_US.UTF-8
            export LC_CTYPE="$LANG"
            export LC_ALL=""

            to

            export LANG=""
            export LC_CTYPE="en_US.UTF-8"
            export LC_ALL=""

            in order to have nearly the same output of locale as she has,

            ~ > locale
            LANG=""
            LC_CTYPE="en_US.UTF-8"
            LC_COLLATE="C"
            LC_TIME="C"
            LC_NUMERIC="C"
            LC_MONETARY="C"
            LC_MESSAGES="C"
            LC_ALL=""

            and ... the file is visible on the Qt-file-dialog featherpad.

            Also, I can open the file and type accented characters.

            @bsduck and @rvp Can you please test this settings and at the same time disable uim on LXQt?
            If it works, I think we should remove the dependency from the desktop's meta-package.
            Thanks.

            • rvp replied to this.
            • Jay likes this.

              Things become even weirder!

              With the same output of locale as you and uim disabled (uninstalled), I get the following results:

              • FeatherPad can now successfully open a file called "caffè", from both file dialogs.

              • Strawberry however still can't open "caffè.m4a". It doesn't show it in its "Files" tab. It does show it but can't open it (button greyed out) in the file dialog which you get from menu Music -> Open file.

              • Keyboard dead keys don't work. Accented characters that have a dedicated key do work, but they have always worked for me.

                bsduck Keyboard dead keys don't work.

                Can not reproduce, they work just fine here. I can type into featherpad without issues but, I'm not using LXQt, just standalone apps.

                bsduck Strawberry however still can't open "caffè.m4a".

                Can not test, I use spotify-player to stream music. Don't have anything stored locally.

                  pin Can not reproduce, they work just fine here. I can type into featherpad without issues but, I'm not using LXQt, just standalone apps.

                  That's really strange. I tried with a factory default CTWM session, no ~/.xinitrc, just manually setting (or not, doesn't make a difference) LC_CTYPE="en_US.UTF-8" before startx to get the same locale settings: dead keys don't work in FeatherPad or any Qt application I tried, while they work in uxterm or GTK applications.

                  I use packages from pkgsrc.smartos.org, do you use self-built packages, maybe with different build options?

                  • pin replied to this.

                    bsduck I don't have problems on FreeBSD with the same programs. Both file dialogs show the file and can open it.

                    Bizarre. Featherpad behaves identically for me on both FreeBSD and NetBSD.

                    pin Can you please test this settings and at the same time disable uim on LXQt?

                    No change (and, didn't expect any) with:

                    $ env LANG=C LC_TIME=C LC_NUMERIC=C LC_MONETARY=C LC_MESSAGES=C featherpad

                    Native (ticked) chooser shows the file, but, tries to open caff?.txt instead of caffè.txt
                    Unticked chooser doesn't show the file at all.

                    Can you guys try this patch?

                    diff -urN FeatherPad-1.3.1.orig/featherpad/main.cpp FeatherPad-1.3.1/featherpad/main.cpp
                    --- FeatherPad-1.3.1.orig/featherpad/main.cpp	2022-07-31 14:37:30.000000000 +0000
                    +++ FeatherPad-1.3.1/featherpad/main.cpp	2022-08-17 23:02:38.864572116 +0000
                    @@ -43,9 +43,17 @@
                     
                     int main (int argc, char **argv)
                     {
                    +    std::locale::global(std::locale(""));
                    +    QLocale::setDefault(QLocale::system());
                    +
                         const QString name = "FeatherPad";
                         const QString version = "1.3.1";
                         const QString firstArg = QString::fromUtf8 (argv[1]);
                    +{
                    +    QTextStream out (stdout);
                    +    out << "File: " << firstArg << Qt::endl;
                    +}
                    +
                         if (firstArg == "--help" || firstArg == "-h")
                         {
                             QTextStream out (stdout);

                    It should be using the user-configured locale (LANG= and LC_ALL=, etc) now, but, doesn't seem to for some C++ reason I can't fathom.

                    Run Featherpad as featherpad caffè.txt (or any other UTF-8 encoded filename) and see if the program prints caff?.txt or caffè.txt when LANG or LC_ALL is set to a UTF-8 locale (any will do: en_US.UTF-8, en_GB.UTF-8, even C.UTF-8).

                    If they are set to the C locale, then it should (obviously) always print caff?.txt.

                    However, even with the patch Featherpad always shows caff?.txt, when this code prints caffè.txt in a UTF-8 locale:

                    //
                    // c++ -fpic q.cpp $(pkg-config --cflags Qt5Core) $(pkg-config --libs Qt5Core)
                    //
                    #include <locale>
                    #include <QTextStream>
                    int main(int argc, char* argv[]) {
                    	if (argc != 2)
                    		return 1;
                            // replace the C++ global locale as well as the C locale
                            //  with the user-preferred locale
                    	std::locale::global(std::locale(""));
                    	const QString filename = QString::fromUtf8(argv[1]);
                    	QTextStream out (stdout);
                    	out << filename << Qt::endl;
                    	return 0;
                    }

                    C++ devs please have a look...

                    PS. I made a cmake project out of this just to test it out. PM me if you want the tarball.

                    • pin replied to this.

                      bsduck So, I need to correct myself, all characters are displayed correctly but typing is not working, I could swear, it worked yesterday :(

                      bsduck while they work in uxterm or GTK applications

                      There was never an issue with terminals or, Gtk, these work.

                      bsduck I use packages from pkgsrc.smartos.org

                      So do I but, I'm running a local build of FeatherPad-1.3.1, default options.

                      • Jay likes this.

                      rvp No change (and, didn't expect any) with:
                      Native (ticked) chooser shows the file, but, tries to open caff?.txt instead of caffè.txt
                      Unticked chooser doesn't show the file at all.

                      The level of weirdness just keeps going up.
                      See, above my reply to @bsduck about typing.
                      If I create a file called caffè with vim, with the word caffè in it. I can open it with featherpad and the word caffè is displayed on the editor.
                      If I type it in featherpad I only get caffe but, if I copy caffè and paste it into featherpad, it works :o

                      All accents display correctly but, none can be typed.

                      rvp However, even with the patch Featherpad always shows caff?.txt

                      So, your patch does not fix it?

                      rvp C++ devs please have a look...

                      PS. I made a cmake project out of this just to test it out. PM me if you want the tarball.

                      Feel free to jump into the discussion, here

                      Note: Still, I'm almost certain I could also type this word yesterday and I haven't changed anything else.

                      • rvp replied to this.

                        pin So, your patch does not fix it?

                        It should, as the other example code shows (comment out the std::locale ... line, or use env LC_ALL=C ./a.out caffè.txt--which has the same effect--to see the difference). Dunno why it doesn't.

                        2 years later

                        Two years later, I finally tested this again:

                        FeatherPad (now Qt6) can open "caffè"
                        Strawberry (Qt5) can open "caffè.m4a"
                        LXQt Archiver (Qt5) can open "caffè.tar.gz"

                        Everything is now working as expected, with LANG=de_CH.UTF-8.

                        Problem solved! Many thanks to @rvp and @pin 🙂

                        • Jay likes this.