diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-01-08 15:28:48 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-01-08 15:28:48 (GMT) |
commit | 2f500df286afba5e64f5288fbc3d02e6e2e41211 (patch) | |
tree | 28afc7ed5f6ca5aa3d4abd240e6bb2852bb8c224 /src/corelib/xml/qxmlstream.cpp | |
parent | d93b2ff9c976a2aea4fb1a7be68565ea0df81ba4 (diff) | |
download | Qt-2f500df286afba5e64f5288fbc3d02e6e2e41211.zip Qt-2f500df286afba5e64f5288fbc3d02e6e2e41211.tar.gz Qt-2f500df286afba5e64f5288fbc3d02e6e2e41211.tar.bz2 |
Use the new QTextCodec api in the QXmlStreamWriter.
Instead of accesing private data, use the QTextCodec::makeEncoder() to pass the
initial conversion flags to the codec.
Also improved the behavior - we shouldn't add BOM in the middle of the data
when dumping xml in all encodings, not only for utf8.
Task-number: QTBUG-7180
Reviewed-by: Thiago
Conflicts:
src/corelib/xml/qxmlstream.cpp
Diffstat (limited to 'src/corelib/xml/qxmlstream.cpp')
-rw-r--r-- | src/corelib/xml/qxmlstream.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index e31ed6d..f879315 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -3005,8 +3005,7 @@ QXmlStreamWriterPrivate::QXmlStreamWriterPrivate(QXmlStreamWriter *q) deleteDevice = false; #ifndef QT_NO_TEXTCODEC codec = QTextCodec::codecForMib(106); // utf8 - encoder = codec->makeEncoder(); - encoder->fromUnicode(QLatin1String("")); // no byte order mark for utf8 + encoder = codec->makeEncoder(QTextCodec::IgnoreHeader); // no byte order mark for utf8 #endif inStartElement = inEmptyElement = false; wroteSomething = false; @@ -3280,9 +3279,7 @@ void QXmlStreamWriter::setCodec(QTextCodec *codec) if (codec) { d->codec = codec; delete d->encoder; - d->encoder = codec->makeEncoder(); - if (codec->mibEnum() == 106) - d->encoder->fromUnicode(QLatin1String("")); // no byte order mark for utf8 + d->encoder = codec->makeEncoder(QTextCodec::IgnoreHeader); // no byte order mark for utf8 } } |