Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-24791

QXmlStreamWriter does not write encoding when destination is a QString

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 4.6.3
    • None

      The following piece of code:

      bool fileWritten = false;
      QString dataBuffer;
      QXmlStreamWriter streamWriter(&dataBuffer);
      streamWriter.setCodec("ISO-8859-1");
      streamWriter.setAutoFormatting(true);
      
      streamWriter.writeStartDocument();
      fileWritten = this->write(streamWriter);
      streamWriter.writeEndDocument();
      

      generates a QString with a startDocument that does not contain the encoding. Replacing the QString by anything else (QFile, QBuffer, QByteArray) works well. But as these classes are full of memory leaks they cannot be used safely in a critical commercial product.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            thiago Thiago Macieira
            alakauf Alain Kaufmann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes