PDA

View Full Version : How to read Hebrew characters from DB and write them in QTableWidget?



tehman
31st January 2012, 10:33
Hello!

I am writing a Qt application. Also I use MS SQL Server 2008. There are data in Hebrew language. I have to read them with QSqlQuery and put them into a QTableWidget. After this writing I have "?????" instead of "טיפקס" e.g. in a corresponding item. I tried to use trUtf8 and QByteArray but I still have problems. Please, help me.

Joshua

Lykurg
31st January 2012, 10:46
Encoding is always a mess. Have you set the local of the MS SQL Server right? Try if QString::fromUtf8(), QString::fromLocal8Bit() or QString::fromLatin1() can solve your problem.

tehman
31st January 2012, 12:55
Thank you, Lykurg, for your help.
No, I have not set the local of the MS SQL Server yet. I have already tried QString::fromUtf8() but there is no good results.
The only case when everything works fine is when one has e.g. "QByteArray encode = "\05E4\05E2\05E9";". But in my database there are "????" instead of characters and they are on my widgets hence.
Anyway, I will try to follow your advices, thanks again.