Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.15, 6.7.2
-
None
-
Debian GNU/Linux sid amd64
Description
As discussed in this forum post, Qt 6 writes unicode characters to QSettings verbatim, whereas Qt 5 tries to backslash-escape them.
This causes a problem when there are setting files shared by Qt 5 and Qt 6, e.g. ~/.config/QtProject.conf which is used by QFileDialog. Let’s suppose you have a directory called Música and want to add it to bookmarks in QFileDialog.
- If you open a Qt 5 app (e.g. Vlc or Krita) and drag that directory to bookmarks, the file will have the following line:
shortcuts=file:, file:///home/dmitry, file:///home/dmitry/M\xfasica
After that, if you launch a Qt 6 app (e.g. Kate), it recognizes it correctly but on exit it will change it to
shortcuts=file:, file:///home/dmitry, file:///home/dmitry/Música
- However if after opening Qt 6 app you launch a Qt 5 app again, it will not recognize the line, in the dialog it will be grayed out and displayed as Música. And on exit Qt 5 will rewrite that line to
shortcuts=file:, file:///home/dmitry, file:///home/dmitry/M\xc3\xbasica
- If you run Qt 5 app, then Qt 6 app, then Qt 5 app again, and repeat this cycle, you will end up with something like
shortcuts=file:, file:///home/dmitry, file:///home/dmitry/M\xc3\x83\xc2\x83\xc3\x82\xc2\x83\xc3\x83\xc2\x82\xc3\x82\xc2\xbasica
after a Qt 5 iteration, or
shortcuts=file:, file:///home/dmitry, file:///home/dmitry/MÃ<U+0083>Â<U+0083>Ã<U+0082>Â<U+0083>Ã<U+0083>Â<U+0082>Ã<U+0082>ºsica
after a Qt 6 iteration.
In Debian, I got a bug report with similar content in the file. The file size was 530M and Qt crashed when trying to load it.
Attachments
Issue Links
- relates to
-
QTBUG-54510 QSettings can't parse UTF-8 ini files
-
- Reported
-
-
QTBUG-102853 QSettings incompatible when reading a config written with Qt6 from Qt5
-
- Reported
-
-
QTBUG-40796 Working with multiple QSettings instances with UTF-8 codec messes up ini file
-
- Open
-
-
QTBUG-23381 QSettings incorrectly processes .ini file with UTF-8 Byte Order Mark (BOM)
-
- Closed
-
-
QTBUG-99401 QSettings: support reading UTF-8 keys from INI files
-
- Closed
-
-
QTBUG-30068 QSettings can't work with INI files with BOM in the beginning
-
- Closed
-
-
QTBUG-101380 QSettings: write keys in INI files using UTF-8
-
- Reported
-
-
QTBUG-133805 QFileDialog shouldn't write to QtProject.conf
-
- Reported
-
Gerrit Reviews
For Gerrit Dashboard: QTBUG-133804 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
624848,1 | QSettings/ini: don't write unescaped UTF-8 | dev | qt/qtbase | Status: NEW | -1 | 0 |