diff --git a/src/preferences/configobject.cpp b/src/preferences/configobject.cpp index f622a0df251..31ff1a94a29 100644 --- a/src/preferences/configobject.cpp +++ b/src/preferences/configobject.cpp @@ -166,7 +166,11 @@ template bool ConfigObject::parse() { int group = 0; QString groupStr, line; QTextStream text(&configfile); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + DEBUG_ASSERT(text.encoding() == QStringConverter::Utf8); +#else text.setCodec("UTF-8"); +#endif while (!text.atEnd()) { line = text.readLine().trimmed(); @@ -213,7 +217,12 @@ bool ConfigObject::save() { return false; } QTextStream stream(&tmpFile); + // UTF-8 is the default in Qt6. +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + DEBUG_ASSERT(stream.encoding() == QStringConverter::Utf8); +#else stream.setCodec("UTF-8"); +#endif QString group = "";