<br>Thanks for the info. Do you know any decent example, tutorial, documents etc. about qt network stack?<br><div class="gmail_quote"><br><br>2011/6/28 Andreas Pakulat <span dir="ltr"><<a href="mailto:apaku@gmx.de">apaku@gmx.de</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On 28.06.11 06:26:24, Yaşar Arabacı wrote:<br>
> Hi,<br>
><br>
> I am havin an encoding problem. If you have read my earlier post, I was<br>
> doing a simple chat application. Here is how it goes.<br>
<br>
</div>You're not converting your data correctly. On the sending side you do it<br>
properly, decoding to utf-8 and then sending the bytes through the<br>
network. On the receiving side you're using Python's socket API, which<br>
gives you a byte-stream and then create a QString from it implicitly.<br>
That uses whatever your systems default-encoding is to decode the bytes<br>
into a string.<br>
<br>
The error is in NetConnectorWorker.run, but its not that easy to fix<br>
since you currently do not send the amount of bytes you cannot know on<br>
the receiving side wether all data has been received or not and hence<br>
you cannot do a correct decoding.<br>
<br>
I suggest to switch to use Qt's network stack, that'll make these things<br>
a bit easier since you can use QDataStream on the network socket which<br>
handles sending QString's just fine.<br>
<br>
If thats not possible, you'll have to add the length of the message into<br>
the byte-stream or always read up to the first \n and decode the content<br>
then and make sure the sender always sends at least 1 \n.<br>
<br>
Andreas<br>
<br>
_______________________________________________<br>
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></blockquote></div><br>