Commit b0bc30bb authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

UTF-8 is the new default for QTextStream.

parent f54eb044
Pipeline #49302 failed with stage
in 11 minutes and 21 seconds
...@@ -196,7 +196,9 @@ void Preferences::setNoAutoStart(bool yes) ...@@ -196,7 +196,9 @@ void Preferences::setNoAutoStart(bool yes)
return; return;
} }
QTextStream stream(&file); QTextStream stream(&file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
stream.setCodec("UTF-8"); stream.setCodec("UTF-8");
#endif
stream.setAutoDetectUnicode(true); stream.setAutoDetectUnicode(true);
lines = stream.readAll().split(QLatin1Char('\n')); lines = stream.readAll().split(QLatin1Char('\n'));
for (int i = 0; i < lines.size(); ++i) for (int i = 0; i < lines.size(); ++i)
...@@ -244,7 +246,9 @@ void Preferences::setNoAutoStart(bool yes) ...@@ -244,7 +246,9 @@ void Preferences::setNoAutoStart(bool yes)
return; return;
} }
QTextStream stream(&file); QTextStream stream(&file);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
stream.setCodec("UTF-8"); stream.setCodec("UTF-8");
#endif
stream << lines.join(QLatin1Char('\n')) << "\n"; stream << lines.join(QLatin1Char('\n')) << "\n";
// QSaveFile doesn't report a write error when the device is full (see Qt // QSaveFile doesn't report a write error when the device is full (see Qt
// bug 75077), so check that the data can actually be written by flush(). // bug 75077), so check that the data can actually be written by flush().
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment