diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-09-08 14:59:05 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-09-15 08:13:27 +0200 |
commit | e96a311334a5c70d5ffcc2ca5c10919952b99636 (patch) | |
tree | 58c4b65892f170ae770bb5e8d74950031558b203 /tests/auto/corelib/text/qstring | |
parent | cb78972e375b9e5f8180b39bd6985ea0be75d2f7 (diff) |
Use UTF-8 when converting 8 bit data in QTextStream
This was overlooked when doing the conversion to use UTF-8 as the
standard 8 bit encoding for text.
Fixes: QTBUG-54942
Change-Id: Ib7b1b75b4d694648ab7143f6930b6bb1dcad19c9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/text/qstring')
-rw-r--r-- | tests/auto/corelib/text/qstring/tst_qstring.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index 8f77d03226..6e1b47a839 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -3963,8 +3963,16 @@ void tst_QString::check_QTextIOStream() { a=""; QTextStream ts(&a); + // invalid Utf8 ts << "pi \261= " << 3.125; - QCOMPARE(a, QString::fromLatin1("pi \261= 3.125")); + QCOMPARE(a, QString::fromUtf16(u"pi \xfffd= 3.125")); + } + { + a=""; + QTextStream ts(&a); + // valid Utf8 + ts << "pi ø= " << 3.125; + QCOMPARE(a, QString::fromUtf16(u"pi ø= 3.125")); } { a="123 456"; |