diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-15 11:06:29 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-16 15:27:11 +0200 |
commit | 4134ffd908144a5cf7c84333d2b2726c86ac8762 (patch) | |
tree | fea82051dced88a943ecad052872df6be9973a85 /sources/pyside2/libpyside | |
parent | 498a6b60f0e36f28f7d086f42f4ee4d1ea5a9069 (diff) |
Fix launching PySide2 from paths with non-ASCII latin characters
QtCore uses QSettings to read the qt.conf file, which uses
Latin1 encoding in Qt 5.
To match this, use Latin1 encoding for the embedded qt.conf as well,
which at least improves the situation for latin characters.
Non-latin characters are unfortunately non-fixable in Qt 5.
Task-number: PYSIDE-972
Change-Id: Ie9c77029327c3531d3491138d826b221497a9119
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/pyside2/libpyside')
-rw-r--r-- | sources/pyside2/libpyside/pyside.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sources/pyside2/libpyside/pyside.cpp b/sources/pyside2/libpyside/pyside.cpp index 66e931164..219b99d48 100644 --- a/sources/pyside2/libpyside/pyside.cpp +++ b/sources/pyside2/libpyside/pyside.cpp @@ -586,16 +586,22 @@ bool registerInternalQtConf() #ifdef PYSIDE_QT_CONF_PREFIX setupPrefix = QStringLiteral(PYSIDE_QT_CONF_PREFIX); #endif - QString prefixPath = pysideDir.absoluteFilePath(setupPrefix); + const QString prefixPathStr = pysideDir.absoluteFilePath(setupPrefix); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + const QByteArray prefixPath = prefixPathStr.toLocal8Bit(); +#else + // PYSIDE-972, QSettings used by QtCore uses Latin1 + const QByteArray prefixPath = prefixPathStr.toLatin1(); +#endif // rccData needs to be static, otherwise when it goes out of scope, the Qt resource system // will point to invalid memory. - static QByteArray rccData = QByteArray("[Paths]\nPrefix = ") + prefixPath.toLocal8Bit() + static QByteArray rccData = QByteArrayLiteral("[Paths]\nPrefix = ") + prefixPath #ifdef Q_OS_WIN // LibraryExecutables needs to point to Prefix instead of ./bin because we don't // currently conform to the Qt default directory layout on Windows. This is necessary // for QtWebEngineCore to find the location of QtWebEngineProcess.exe. - + QByteArray("\nLibraryExecutables = ") + prefixPath.toLocal8Bit() + + QByteArray("\nLibraryExecutables = ") + prefixPath #endif ; rccData.append('\n'); |