17/02/2011

Qt display ° (temperature degree) character in Linux

Although the ° character will ouput correctly on Windows, it gives strange things instead on Linux.

This is what I found from Qt forum: "QString by default assumes a conversion from C Strings using a local 8 bit encoding which is different for different systems. Therefore what works on Windows will not work on Linux. You need to explicitely set what encoding should be used either by QTextCodec::setCodecForCStrings() or by explicitely saying which codec to use for a particular conversion, for instance QString::fromUtf8()."