PDA

View Full Version : QLineEdit and scandinavian characacters



teele
1st August 2010, 08:39
If i set the text "Åååps" or "Äärgh" in a QTextEdit field in my source file, something messy appears when the program is run. The character set is utf-8. For instance,

formulaInput->setText(tr("Ååååh, Synöve"));

where formulaInput is a QLineEdit field.

What is the trick to get the same text shown in the executable as well.

teele

Lykurg
1st August 2010, 08:44
Make sure your file is encoded in utf8 and then use QObject::trUtf8().

teele
1st August 2010, 09:59
Indeed,

formulaInput->setText(trUtf8("Ååååh, Synöve"));

solved it. Thank you, Lykurg!