Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED]Qt 4.7 udpsocket and encoding issue
3lias last edited by
my name is ilias.I am studying Computers Science in Greece.This period i am composing my degree exercise which is about an automated system about students registration in my college.
I have developed my application in two parts:
1)the first one will be used on a small number of computers where someone will can go and fill the form for his registration(clients)
2)the second one will be installed on a computer only("server") and it will be the computer which will receive the forms from computers where app 1 will be installed.
My issue now:
To application 2(server) i want to receive greek characters - that user would filled on their forms.I am using a QUdpSocket to do this but my problem will continue exist even if i change to QTcpSocket(i want to).
the code tha application 1 use to send(to get data i use a vector<QString> where i have stored the fields tha user has complete)
for (int i = 0 ; i < 18 ; i++)
QByteArray datagram = array[i].toAscii();
udpSocket->writeDatagram(datagram.data(), datagram.size(),QHostAddress::Broadcast, 45454);
but the only thing i receive is something like "??????? ???? ???".
the code that application 2 use to receive elements and store them in a vector<QString>
array[cnt1][cnt2] = datagram.data();
I have tried to change the encoding of the element before send and after receiving with this function that i have made:
//Encoding transformation to greek 'windows-1253'
QString MainWindow::transform_text(QByteArray temp)
QTextCodec *codec = QTextCodec::codecForName("Windows-1253");
QString string = codec->toUnicode(temp);
but it didn't work.
So, i am asking for your help about sending Greek Characters and receiving correct threw a QUdpSocket.
For any information about i will be glad to answer.
tony last edited by
replied in the other post.
3lias last edited by
Thank you very much.
I try it the way you suggest me and worked perfectly :)