[Qt-interest] QXmlStreamWriter not adding encoding attribute.

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Tue May 17 01:50:46 CEST 2011


When used with a string output, the encoding is not necessary, since the
string implies utf-16.  Try using a QByteArray instead.  If necessary, use
setCodec as well.  There used to be some documentation for this, but I can't
find it now.  
 
Tony
 
 

-----Original Message-----
From: qt-interest-bounces+tony.rietwyk=rightsoft.com.au at qt.nokia.com
[mailto:qt-interest-bounces+tony.rietwyk=rightsoft.com.au at qt.nokia.com] On
Behalf Of JD Guzman
Sent: Tuesday, 17 May 2011 08:44 AM
To: qt-interest
Subject: [Qt-interest] QXmlStreamWriter not adding encoding attribute.


Hello all, 

Now I may be doing something wrong but I can't seem to get the xml stream
writer to add the encoding attribute to the xml tag.  Here is my sample
code.

QString meta;
QXmlStreamWriter writer(&meta);
writer.setAutoFormatting(true);
writer.writeStartDocument();
writer.writeEndDocument();

return meta;


Here is what the output looks like.

<?xml version="1.0"?>

As you can see this is not what I woud expect which is.

<?xml version="1.0" encoding="UTF-8"?>

Any ideas?

Regards,

JD


-----

No virus found in this message.

Checked by AVG - www.avg.com

Version: 10.0.1375 / Virus Database: 1500/3642 - Release Date: 05/16/11

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110517/4aabfc58/attachment.html 


More information about the Qt-interest-old mailing list