Default codec for QTextStream is UTF-8 since Qt6.

This commit is contained in:
Roman Telezhynskyi 2023-02-09 16:24:00 +02:00
parent c9786ed7b7
commit e280c309cb
2 changed files with 6 additions and 0 deletions

View File

@ -340,7 +340,9 @@ void VAbstractConverter::Save()
m_tmpFile.resize(0);//clear previous content m_tmpFile.resize(0);//clear previous content
const int indent = 4; const int indent = 4;
QTextStream out(&m_tmpFile); QTextStream out(&m_tmpFile);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
out.setCodec("UTF-8"); out.setCodec("UTF-8");
#endif
save(out, indent); save(out, indent);
if (not m_tmpFile.flush()) if (not m_tmpFile.flush())

View File

@ -83,7 +83,9 @@ static const auto V_UNUSED V_EX_CONFIG = 78; /*Something was found in an un
inline QTextStream& vStdErr() inline QTextStream& vStdErr()
{ {
static QTextStream ts(stderr, QIODevice::Unbuffered | QIODevice::WriteOnly); static QTextStream ts(stderr, QIODevice::Unbuffered | QIODevice::WriteOnly);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
ts.setCodec("UTF-8"); ts.setCodec("UTF-8");
#endif
return ts; return ts;
} }
@ -91,7 +93,9 @@ inline QTextStream& vStdErr()
inline QTextStream& vStdOut() inline QTextStream& vStdOut()
{ {
static QTextStream ts(stdout, QIODevice::Unbuffered | QIODevice::WriteOnly); static QTextStream ts(stdout, QIODevice::Unbuffered | QIODevice::WriteOnly);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
ts.setCodec("UTF-8"); ts.setCodec("UTF-8");
#endif
return ts; return ts;
} }