[Qt-interest] Have QXmlStreameWriter write the encoding information

Andreas Pakulat apaku at gmx.de
Wed Jun 3 23:01:43 CEST 2009


On 03.06.09 11:04:04, Lingfa Yang wrote:
> Andreas Pakulat wrote:
> > That will produce
> >
> > <?xml version="1.0"?><?xml version="1.0" encoding="UTF-8"?>
> >
> > so definetly not what he wants.
> >
> > If you're writing into a QString there's simply no point in adding an
> > encoding, because the encoding is dictated by QString.
> >
> > Andreas
> >
> >   
> Try it, Andreas. It does work:-)

No it doesn't. As I said that produces two <?xml ...?> processing
instructions and I wouldn't place a bet on how many parsers will use the
encoding from the second instead of defaulting to utf-8. Apart from that
it adds redudant information to the xml and looks quite strange to
people that are used to xml.

Andreas

-- 
You display the wonderful traits of charm and courtesy.



More information about the Qt-interest-old mailing list