diff options
Diffstat (limited to 'src/corelib/xml/qxmlstream.cpp')
-rw-r--r-- | src/corelib/xml/qxmlstream.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index 1bf00b8..5717ca2 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -3003,7 +3003,8 @@ QXmlStreamWriterPrivate::QXmlStreamWriterPrivate(QXmlStreamWriter *q) deleteDevice = false; #ifndef QT_NO_TEXTCODEC codec = QTextCodec::codecForMib(106); // utf8 - encoder = codec->makeEncoder(QTextCodec::IgnoreHeader); // no byte order mark for utf8 + encoder = codec->makeEncoder(); + encoder->state.flags |= QTextCodec::IgnoreHeader; // no byte order mark for utf8 #endif inStartElement = inEmptyElement = false; wroteSomething = false; @@ -3277,7 +3278,9 @@ void QXmlStreamWriter::setCodec(QTextCodec *codec) if (codec) { d->codec = codec; delete d->encoder; - d->encoder = codec->makeEncoder(QTextCodec::IgnoreHeader); // no byte order mark for utf8 + d->encoder = codec->makeEncoder(); + if (codec->mibEnum() == 106) + d->encoder->state.flags |= QTextCodec::IgnoreHeader; // no byte order mark for utf8 } } |