Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, March 2008
QXmlStreamWriter writes binary garbage.


Message 1 in thread

Hi,
so i connected a QXmlStreamWriter and a QXmlStreamReader via sockets. works 
perfectly fine, but i need to debug the network stream. well, i connected 
readyRead() of the receiving end and feed the Reader with addData. Still 
works fine (the reader reads without errors) but the data i get from 
readAll() is totaly garbage. it's not human readable. is it compressed?


            QByteArray k =m_device->readAll();
            qDebug()<<k.size()<<k;
	   reader.addData(k);



output:


1930 "ÿþ<


1424 "

810 "

252 "



i would expect something like <?xml version="1.0"><nodetalk 
version="2.0"><query><root/><query>  etc etc.


yeah i tryed replace('\0','0'). that shows up:
530 "0

in case it is usefull, here is the toHex output (so many 0's .. odd):

1924 "0a0020002000200020003c0072006500730070006f006e00730065003e000a00200020002000200020002000200020003c006900740065006d003e000a002000200020002000200020002000200020002000200020003c006900640065006e0074003e0034003c002f006900640065006e0074003e000a002000200020002000200020002000200020002000200020003c006e0061006d0065003e006f006e0065003c002f006e0061006d0065003e000a002000200020002000200020002000200020002000200020003c0074007900700065003e0078006d006c002f007400650073007400730074007500660066003c002f0074007900700065003e000a002000200020002000200020002000200020002000200020003c006300680069006c006400720065006e003e000a0020002000200020002000200020002000200020002000200020002000200020003c006900640065006e0074003e003200330030003c002f006900640065006e0074003e000a0020002000200020002000200020002000200020002000200020002000200020003c002f006300680069006c006400720065006e003e000a002000200020002000200020002000200020002000200020003c002f006900740065006d003e000a00200020002000200020002000200020003c002f0072006500730070006f006e00730065003e000a0020002000200020003c0072006500730070006f006e00730065003e000a00200020002000200020002000200020003c006900740065006d003e000a002000200020002000200020002000200020002000200020003c006900640065006e0074003e003200380038003c002f006900640065006e0074003e000a002000200020002000200020002000200020002000200020003c006e0061006d0065003e006600640073003c002f006e0061006d0065003e000a002000200020002000200020002000200020002000200020003c0074007900700065003e0078006d006c002f007400650073007400730074007500660066003c002f0074007900700065003e000a002000200020002000200020002000200020002000200020003c006300680069006c006400720065006e003e003c002f006300680069006c006400720065006e003e000a002000200020002000200020002000200020002000200020003c002f006900740065006d003e000a00200020002000200020002000200020003c002f0072006500730070006f006e00730065003e000a0020002000200020003c0072006500730070006f006e00730065003e000a00200020002000200020002000200020003c006900740065006d003e000a002000200020002000200020002000200020002000200020003c006900640065006e0074003e003200300039003c002f006900640065006e0074003e000a002000200020002000200020002000200020002000200020003c006e0061006d0065003e007900610079003c002f006e0061006d0065003e000a002000200020002000200020002000200020002000200020003c0074007900700065003e0078006d006c002f007400650073007400730074007500660066003c002f0074007900700065003e000a002000200020002000200020002000200020002000200020003c006300680069006c006400720065006e003e000a0020002000200020002000200020002000200020002000200020002000200020003c006900640065006e0074003e0039003c002f006900640065006e0074003e000a0020002000200020002000200020002000200020002000200020002000200020003c002f006300680069006c006400720065006e003e000a002000200020002000200020002000200020002000200020003c002f006900740065006d003e000a00200020002000200020002000200020003c002f0072006500730070006f006e00730065003e000a0020002000200020003c0072006500730070006f006e00730065003e000a00200020002000200020002000200020003c006900740065006d003e000a002000200020002000200020002000200020002000200020003c006900640065006e0074003e0031003c002f006900640065006e0074003e000a002000200020002000200020002000200020002000200020003c006e0061006d0065003e00740077006f0069003c002f006e0061006d0065003e000a002000200020002000200020002000200020002000200020003c0074007900700065003e0078006d006c002f007400650073007400730074007500660066003c002f0074007900700065003e000a002000200020002000200020002000200020002000200020003c006300680069006c006400720065006e003e000a0020002000200020002000200020002000200020002000200020002000200020003c006900640065006e0074003e00310036003c002f006900640065006e0074003e000a0020002000200020002000200020002000200020002000200020002000200020003c002f006300680069006c006400720065006e003e000a002000200020002000200020002000200020002000200020003c002f006900740065006d003e000a00200020002000200020002000200020003c002f0072006500730070006f006e00730065003e00" 
1424 "0a0020002000200020003c0072006500730070006f006e00730065003e000a00200020002000200020002000200020003c006900740065006d003e000a002000200020002000200020002000200020002000200020003c006900640065006e0074003e003200330030003c002f006900640065006e0074003e000a002000200020002000200020002000200020002000200020003c006e0061006d0065003e00610020003c002f006e0061006d0065003e000a002000200020002000200020002000200020002000200020003c0074007900700065003e0078006d006c002f007400650073007400730074007500660066003c002f0074007900700065003e000a002000200020002000200020002000200020002000200020003c006300680069006c006400720065006e003e000a0020002000200020002000200020002000200020002000200020002000200020003c006900640065006e0074003e003300310032003c002f006900640065006e0074003e000a0020002000200020002000200020002000200020002000200020002000200020003c002f006300680069006c006400720065006e003e000a002000200020002000200020002000200020002000200020003c002f006900740065006d003e000a00200020002000200020002000200020003c002f0072006500730070006f006e00730065003e000a0020002000200020003c0072006500730070006f006e00730065003e000a00200020002000200020002000200020003c006900740065006d003e000a002000200020002000200020002000200020002000200020003c006900640065006e0074003e0039003c002f006900640065006e0074003e000a002000200020002000200020002000200020002000200020003c006e0061006d0065003e007a00650072006f003c002f006e0061006d0065003e000a002000200020002000200020002000200020002000200020003c0074007900700065003e0078006d006c002f007400650073007400730074007500660066003c002f0074007900700065003e000a002000200020002000200020002000200020002000200020003c006300680069006c006400720065006e003e000a0020002000200020002000200020002000200020002000200020002000200020003c006900640065006e0074003e00390035003c002f006900640065006e0074003e000a0020002000200020002000200020002000200020002000200020002000200020003c002f006300680069006c006400720065006e003e000a002000200020002000200020002000200020002000200020003c002f006900740065006d003e000a00200020002000200020002000200020003c002f0072006500730070006f006e00730065003e000a0020002000200020003c0072006500730070006f006e00730065003e000a00200020002000200020002000200020003c006900740065006d003e000a002000200020002000200020002000200020002000200020003c006900640065006e0074003e00310036003c002f006900640065006e0074003e000a002000200020002000200020002000200020002000200020003c006e0061006d0065003e007400680072006500650078003c002f006e0061006d0065003e000a002000200020002000200020002000200020002000200020003c0074007900700065003e0078006d006c002f007400650073007400730074007500660066003c002f0074007900700065003e000a002000200020002000200020002000200020002000200020003c006300680069006c006400720065006e003e003c002f006300680069006c006400720065006e003e000a002000200020002000200020002000200020002000200020003c002f006900740065006d003e000a00200020002000200020002000200020003c002f0072006500730070006f006e00730065003e00" 
810 "0a0020002000200020003c0072006500730070006f006e00730065003e000a00200020002000200020002000200020003c006900740065006d003e000a002000200020002000200020002000200020002000200020003c006900640065006e0074003e003300310032003c002f006900640065006e0074003e000a002000200020002000200020002000200020002000200020003c006e0061006d0065003e006f0066003c002f006e0061006d0065003e000a002000200020002000200020002000200020002000200020003c0074007900700065003e0078006d006c002f007400650073007400730074007500660066003c002f0074007900700065003e000a002000200020002000200020002000200020002000200020003c006300680069006c006400720065006e003e003c002f006300680069006c006400720065006e003e000a002000200020002000200020002000200020002000200020003c002f006900740065006d003e000a00200020002000200020002000200020003c002f0072006500730070006f006e00730065003e000a0020002000200020003c0072006500730070006f006e00730065003e000a00200020002000200020002000200020003c006900740065006d003e000a002000200020002000200020002000200020002000200020003c006900640065006e0074003e00390035003c002f006900640065006e0074003e000a002000200020002000200020002000200020002000200020003c006e0061006d0065003e0074006800690073003c002f006e0061006d0065003e000a002000200020002000200020002000200020002000200020003c0074007900700065003e0078006d006c002f007400650073007400730074007500660066003c002f0074007900700065003e000a002000200020002000200020002000200020002000200020003c006300680069006c006400720065006e003e003c002f006300680069006c006400720065006e003e000a002000200020002000200020002000200020002000200020003c002f006900740065006d003e000a00200020002000200020002000200020003c002f0072006500730070006f006e00730065003e00" 



-- 
 [ signature omitted ] 

Message 2 in thread

On Monday 17 March 2008 13:55:44 Arvid Ephraim Picciani wrote:
>so i connected a QXmlStreamWriter and a QXmlStreamReader via sockets. works 
>perfectly fine, but i need to debug the network stream. well, i connected 
>readyRead() of the receiving end and feed the Reader with addData. Still 
>works fine (the reader reads without errors) but the data i get from 
>readAll() is totaly garbage. it's not human readable. is it compressed?

It's not garbage. It's also not compressed.

> 0a0020002000200020003c0072006500730070006f006e00730065003e000a0020002000200
>0200020002000200020003c006900740065006d003e000a

The above is:
"\n"
"    <response>\n"
"        <item>\n"

encoded in UTF-16 little endian.

> in case it is usefull, here is the toHex output (so many 0's .. odd):

that many zeroes should have been your clue that it was UTF-16.

-- 
 [ signature omitted ] 

Attachment: signature.asc
Description: This is a digitally signed message part.


Message 3 in thread

On Monday 17 March 2008 14:27:25 Thiago Macieira wrote:
> On Monday 17 March 2008 13:55:44 Arvid Ephraim Picciani wrote:
> >so i connected a QXmlStreamWriter and a QXmlStreamReader via sockets.
> > works perfectly fine, but i need to debug the network stream. well, i
> > connected readyRead() of the receiving end and feed the Reader with
> > addData. Still works fine (the reader reads without errors) but the data
> > i get from readAll() is totaly garbage. it's not human readable. is it
> > compressed?
>
> It's not garbage. It's also not compressed.
>
> > 0a0020002000200020003c0072006500730070006f006e00730065003e000a00200020002
> >00 0200020002000200020003c006900740065006d003e000a
>
> The above is:
> "\n"
> "    <response>\n"
> "        <item>\n"
>
> encoded in UTF-16 little endian.
aaah!  thank you

> > in case it is usefull, here is the toHex output (so many 0's .. odd):
>
> that many zeroes should have been your clue that it was UTF-16.
true. *hides in shame*


-- 
 [ signature omitted ]