Symbian mobile app - wrong charset - encoding
-
Hello,
!http://alergiaapp.madnes.eu/alergiaapp.jpg(app)!I developing mobile application in slovak language. I have everywere set encoding UTF-8. But slovak special characters are wrong on mobile. See the picture. Thanks for help.
-
Have You tried playing with QTextCodec??
QTextCodec::setCodecForCStrings() or void QTextCodec::setCodecForLocale ( QTextCodec * c )
-
@int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QTextCodec::setCodecForCStrings(codec);
QTextCodec::setCodecForLocale(codec);
........
return app.exec();
}@ -
Actually the text encoding should match with the encoding used by the files that hold the text you want to read (e.g. your source files). If your editor stores the strings in non-utf8 and you instruct Qt to load the strings assuming it will be utf8 then this will not work correctly.
-
lukiluuk: If you know you are getting Utf8 then you can use QString::fromUtf8(). There is also some conversion routine for ASCII and Latin1 (both of which are straight forward to turn into unicode and thus do not need the full TextCodec treatment:-).