summaryrefslogtreecommitdiffstats
path: root/src/corelib/xml/qxmlstream.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-10 23:27:10 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-10 23:27:10 +0200
commitcbe332405aa22257d432f1797b325f5e57007c20 (patch)
tree0d817dc7ed2f3a2f6035f924a824d351420910c5 /src/corelib/xml/qxmlstream.cpp
parentd2c6294bd5cc3c2e61aaa0c83bfd74941ced150e (diff)
parent67ca72796e23269451795baf9adde02a184a7b9e (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: configure mkspecs/macx-ios-clang/features/default_pre.prf mkspecs/macx-ios-clang/features/sdk.prf mkspecs/unsupported/freebsd-g++46/qplatformdefs.h src/widgets/styles/qgtkstyle.cpp tests/auto/corelib/io/qdiriterator/qdiriterator.pro tests/auto/corelib/io/qfileinfo/qfileinfo.pro Change-Id: Ia943555d1e59234a66f7dc65bdfda838e40001b5
Diffstat (limited to 'src/corelib/xml/qxmlstream.cpp')
-rw-r--r--src/corelib/xml/qxmlstream.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index df5f3711cc..3949d2c3ac 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -3025,10 +3025,14 @@ void QXmlStreamWriterPrivate::checkIfASCIICompatibleCodec()
{
#ifndef QT_NO_TEXTCODEC
Q_ASSERT(encoder);
- // assumes ASCII-compatibility for all 8-bit encodings
- QChar space = QLatin1Char(' ');
- const QByteArray bytes = encoder->fromUnicode(&space, 1);
- isCodecASCIICompatible = (bytes.count() == 1);
+ // test ASCII-compatibility using the letter 'a'
+ QChar letterA = QLatin1Char('a');
+ const QByteArray bytesA = encoder->fromUnicode(&letterA, 1);
+ const bool isCodecASCIICompatibleA = (bytesA.count() == 1) && (bytesA[0] == 0x61) ;
+ QChar letterLess = QLatin1Char('<');
+ const QByteArray bytesLess = encoder->fromUnicode(&letterLess, 1);
+ const bool isCodecASCIICompatibleLess = (bytesLess.count() == 1) && (bytesLess[0] == 0x3C) ;
+ isCodecASCIICompatible = isCodecASCIICompatibleA && isCodecASCIICompatibleLess ;
#else
isCodecASCIICompatible = true;
#endif