You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, November 19th 2014, 4:15pm

QLabel , QString encoding special characters

Hi @all,

I have some problems with QLabel and QString.

When I put my string "à°ç§éùè¨ÄÖÜüäößòè¡ñçáéšěčířž" in the text-proberty from my QLabel in the QT-Creator Designer it look like this
index.php?page=Attachment&attachmentID=3160 => OK

But when the App is running I get the the datastring offer TCP/IP and save it in a QString when I show it with qDebug() << myString
it is also OK all characters are showed.

When I set this string to my QLabel => myQLabel.setText(myString) it look like this
index.php?page=Attachment&attachmentID=3161 some characters are missed.

I test things like this:

QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));

but then I see only 3 characters and in the qDebug looks like ??????e?c??r?

When I have a look in my ui_....h where my QLabel is defined I see this
myLabel->setText(QApplication::translate("Display_z03", "\303\240\302\260\303\247\302\247\303\251\303\271\303\250\302\250\303\204\303\226\303\234\303\274\303\244\303\266\303\237\303\262\303\250\302\241\303\261\303\247\303\241\303\251\305\241\304\233\304\215\303\255\305\231\305\276", 0, QApplication::UnicodeUTF8));

There are all characters as dec./hex values have I translate all special characters to this values?

The local Codec => QTextCodec::codecForLocale()->name(); is "ISO 8859-1"

Why are all characters rigth in the QString and can showed by qDebug() but in the QLabel are some Characters missed?
Have I map this characters to a hex Value?

Thank you for helping hands

Bye Magnus