Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.4.3
-
None
Description
QXmlStreamReader::characterOffset() returns the wrong value for the first tag when the encoding is not UTF-8
–
Can be reproduced using:
#include <QXmlStreamReader> #include <QDebug> int main() { // If you uncomment the <?xml> header characterOffset() works as expected const char data[] = //"<?xml version='1.0' encoding='UTF-8'?>" "<Tag1 attribute='X'><Tag2><Tag3>Y</Tag3></Tag2></Tag1>"; QXmlStreamReader xml(data); int offset=0; while(!xml.atEnd()) { xml.readNext(); if(xml.isStartElement()) { qDebug() << data; qDebug() << (QByteArray(offset, ' ')+"^").constData(); } offset=xml.characterOffset(); } }