summaryrefslogtreecommitdiffstats
path: root/tests/auto/utf8/tst_utf8.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/utf8/tst_utf8.cpp')
-rw-r--r--tests/auto/utf8/tst_utf8.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/auto/utf8/tst_utf8.cpp b/tests/auto/utf8/tst_utf8.cpp
index 0d754b0..f255e6e 100644
--- a/tests/auto/utf8/tst_utf8.cpp
+++ b/tests/auto/utf8/tst_utf8.cpp
@@ -299,10 +299,19 @@ void tst_Utf8::invalidUtf8_data()
void tst_Utf8::invalidUtf8()
{
QFETCH(QByteArray, utf8);
+ QFETCH_GLOBAL(bool, useLocale);
QSharedPointer<QTextDecoder> decoder = QSharedPointer<QTextDecoder>(codec->makeDecoder());
QString decoded = decoder->toUnicode(utf8);
- QVERIFY(decoder->hasFailure());
+
+ // Only enforce correctness on our UTF-8 decoder
+ // The system's UTF-8 codec is sometimes buggy
+ // GNU libc's iconv is known to accept U+FFFF and U+FFFE encoded as UTF-8
+ // OS X's iconv is known to accept those, plus surrogates and codepoints above U+10FFFF
+ if (!useLocale)
+ QVERIFY(decoder->hasFailure());
+ else if (!decoder->hasFailure())
+ qWarning("System codec does not report failure when it should. Should report bug upstream.");
}
QTEST_MAIN(tst_Utf8)