Incorrect directory name encoding

Started by Alex Chernous, March 03, 2024, 12:51:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Alex Chernous

Hi Liviu! Thank you for your great work!

From version 6.12.0 (adding history), when the program is run, a directory is created (auto-saving, working, importing) but in wrong encoding (see attachment).

When you set the location of files in the settings again, this does not happen.

I tried to change the directory name in the settings file, but it didn't work, the encoding changed again and the directories were created.

I would like to help fix this in the code, but I did not understand where is making these directories.

Liviu Lalescu

Hello, Alex, and thank you for the appreciation!

I am very interested to fix this potential bug. So:

- Could you please confirm that exactly in FET-6.12.0 appeared this problem? (so, in FET-6.11.1 this problem did not appear?)

- Could you please tell me what operating system do you use?

- Do you use FET precompiled by me or do you compile? What Qt, for FET-6.12.0 and FET-6.11.1?

The part of saving the data is in src/engine/rules.cpp, line 16557, and in src/interface/fetmainform.cpp, line 4975 (and in other places, search "fileSave").

Volker Dirr

I wonder why there are in fact 2 of that strange directories.
Should be normally only one directory called "fet-results".
Did you replace that name by Cyrillic script? (And please answer Livius questions. They are more important.)

Alex Chernous

1. I downloaded the archives from and will check both versions. But the compilation takes about 1 hours. I remember that the problem arose when it became possible to record the history.
2. uname -a
Linux mentor 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux
3. Compiling myself:
qmake ; makeSometimes I use Qt Creator.
qmake -v
QMake version 3.1
Using Qt version 5.15.8 in /usr/lib/x86_64-linux-gnu

qtcreator -version
Qt Creator 9.0.2 based on Qt 6.4.2

Alex Chernous

Quote from: Volker Dirr on March 03, 2024, 01:31:25 PMI wonder why there are in fact 2 of that strange directories.
Should be normally only one directory called "fet-results".
Did you replace that name by Cyrillic script? (And please answer Livius questions. They are more important.)

In my settings, the path is: /home/alex/Школа/Расписание and this path is re-created, but in a different encoding.I checked this same path.

Liviu Lalescu

I am sorry that you lose so much time compiling!

But do you know that if you have multi-threaded processor you can do "make -j 16" (I have 8 cores 16 threads processor)? It will be much faster. If you have 4 threads, do "make -j 4".

If you want, I have the old precompiled FET for GNU/Linux. I can put on my server for you. But I precompiled with Qt 6.

I highly recommend you to use Qt 6.

Alex Chernous

I know about multi-thread compilation, by the way, from you. I use make -j4 on this computer. And now I install Qt 6.

Liviu Lalescu

OK, good!

Hmm... on the other hand, I wonder about the bug... it shouldn't have appeared. I use Qt QString, which is UTF-8 or UTF-16, I am not sure.

I will try now to replicate this bug on my computer. I have Qt 6.6.2, but I also have Qt 5.15.2, on GNU/Linux. I will copy/paste your directory name.

Compilation on my computer takes 9 minutes with Qt 6 and less with Qt 5.

Liviu Lalescu

Dear Alex,

It is an issue, indeed. Seems like Qt 5.15.2 sets the directory "bad" and Qt 6.6.2 sets the directory "good". See the attached small files.

I will try to investigate a bit. Please don't waste your time compiling, I have found the issue. Thank you for the bug report!

Luckily, the issue is easy to fix, exactly as you said in your first post, reset the directory.

I think you used FET with Qt 6 and then FET with Qt 5.

There are some changes also in Qt 6.4 of the QSettings class (compared with Qt <6.4, like Qt 6.3 or Qt 5.15).

Liviu Lalescu

I updated Qt 5.15.2 "correct" way of storing the directory (a new file was added in my previous post).

Hmm... I don't know how I can solve this small problem. Luckily it is small.

Alex Chernous

Thanks for your prompt reply. But there was no such problem with the encoding before, even when compiling with a Qt 5 version and older. I've been using FET for a long time and compiling it myself. I will try to carefully localize when it appeared.

Liviu Lalescu

You used FET only with Qt 5 until day X. You used then FET with Qt 6. Then again with Qt 5.

Please see attached screenshot of Qt doc.

Liviu Lalescu

I found a possible fix, but I don't like it. I attach the file. You can see the fixes if you search the text setIniCodec (it appears in 2 places: line 390 and 598, adding stuff like 'newSettings.setIniCodec("UTF-8")'). Unfortunately, in line 598, when writing the settings, I don't know why I need not to apply the fix (I commented this line in the file attached below). Note that this fix is only for Qt 5 (easy to correct for Qt 6 with an #if).

With the fix in line 390, it works, but after saving the settings the file still looks ugly, they still have the \x... stuff.

I don't like this fix, because it is not symmetrical and the saved configuration file is not looking correctly.

I think I will add this in the TODO. I am not sure I will search some more for a fix.

The bug only appears if you use an INI-style file for the settings (macOS or GNU/Linux, not Windows), and use FET with Qt 5 after using FET with Qt 6 (not viceversa).

Volker Dirr

hmm... I think/hope that bug won't happen many times. Qt 5 will be end of life next year.

How about adding an execuatble that do nothing else than clearing the settings (of course it should ask first).

It might help in rare cases or if someone want to uninstall.

Alex Chernous

Yes, you're right. This is a problem when using the same config file for different FET (Qt) versions.
When I deleted the .config/fet/fettimetabling.conf file, any versions work fine and created default directories in fet-results