Skip to content

Qt6: recent project paths are stored in QGIS.ini in UTF-8 (instead of hex-escaped Unicode), incompatible with Qt5 version #60088

Description

@justinbb

What is the bug or the crash?

Using a Mac Qt6 build (thanks @m-kuhn!)
– the QGIS.ini file from regular (Qt5) releases is interpreted correctly
– but when it is written back out, recent project paths are encoded in UTF-8
The UTF-8 encoded QGIS.ini cannot be read correctly by Qt5 QGIS, which tries to interpret each octet of UTF-8 as if it were a separate Unicode character.
The UTF-8 QGIS.ini is (fortunately) interpreted correctly by Qt6 QGIS. Switching back and forth between Qt5 and Qt6 builds, however, leads to increasing problems.

Steps to reproduce the issue

  1. In a Qt5 QGIS, create a project and save it under a name containing a non-ASCII character, e.g. • (U+2022). Quit QGIS
  2. Examine QGIS.ini with a text editor. In the recentProjects section, find the newly saved project: its name will contain \x2022
  3. Now open Qt6 QGIS. Note the (correct) filename in the recent projects lists. Quit QGIS
  4. Examine QGIS.ini with a text editor. The project's name will have been rewritten in UTF-8, so it will display normally if the text editor is correctly interpreting UTF-8 text. The hex codes for the • character will be E2 80 A2.
  5. Open Qt5 QGIS. In the recent files list, the file is greyed out and its name is displayed incorrectly with three characters in place of the •, the Unicode code points U+00E2 U+0080 U+00A2. Quit QGIS
  6. Examine QGIS.ini with a text editor again, there will now be \xe2\x80\xa2, the misinterpretation is now hex-escaped and getting difficult to recover from.

Versions

QGIS version | 3.41.0-Master -- | -- QGIS code revision | 9f6d7bd   Libraries Qt version | 6.8.1 Python version | 3.11.10 GDAL/OGR version | 3.9.3 PROJ version | 9.5.1 EPSG Registry database version | v11.022 (2024-11-05) GEOS version | 3.13.0-CAPI-1.19.0 SQLite version | 3.47.2 PDAL version | 2.8.1 PostgreSQL client version | unknown SpatiaLite version | 5.1.0 QWT version | 6.3.0 QScintilla2 version | 2.14.1 OS version | macOS Sonoma (14.7)   Active Python plugins db_manager | 0.1.20 MetaSearch | 0.3.6 processing | 2.12.99

QGIS version
3.41.0-Master
QGIS code revision
9f6d7bd6

Libraries
Qt version
6.8.1
Python version
3.11.10
GDAL/OGR version
3.9.3
PROJ version
9.5.1
EPSG Registry database version
v11.022 (2024-11-05)
GEOS version
3.13.0-CAPI-1.19.0
SQLite version
3.47.2
PDAL version
2.8.1
PostgreSQL client version
unknown
SpatiaLite version
5.1.0
QWT version
6.3.0
QScintilla2 version
2.14.1
OS version
macOS Sonoma (14.7)

Active Python plugins
db_manager
0.1.20
MetaSearch
0.3.6
processing
2.12.99

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

Although this is not an issue if one sticks to Qt5 or Qt6, it makes switching back and forth difficult (unless one limits filenames to ASCII characters). Some sort of workaround would be helpful to avoid problems when the transition arrives.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugEither a bug report, or a bug fix. Let's hope for the latter!RegressionSomething which used to work, but doesn't anymoreWindowsRelated to Windows operating systemmacOSqt6

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions