Since we've converted all our source and header files to unicode, we're facing problems with german umlauts. Everything is fine in the source but QLabels and other gui components are showing umlauts garbled.
ISO-8859-1 source works fine but causes problems when switching between OSX and Windows.
Is there anything I have to set in the project file?
Environment: Qt 4.7 with Qt Creator 2.3.0 using MinGW on Windows XP SP3
Try to call
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
just after creating the QApplication
object. QTextCodec::setCodecForTr
is only needed if your using tr()
.
EDIT: This works only for Qt older than version 5. Newer Qt versions expect the source files to be converted to UTF-8.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With