PDA

View Full Version : Source files in UTF-8 and strange letters in program windows under Windows 7.



jmj
29th August 2010, 10:24
I write my programs with UTF-8 file encoding. And in my programs (in their windows) I have wrong/strange letters instead my national characters.
I checked my file encoding both in Qt Creator and in Notepad++ and in these editors national characters are properly displayed when file encoding is UTF-8. I checked strings in .exe files, and they are UTF-8 too.

I also added to my .pro files line:
CODECFORSRC = UTF-8
And in main.cpp I added lines:
QTextCodec::setCodecForTr(QTextCodec::codecForName ("UTF-8"));
QTextCodec::setCodecForLocale(QTextCodec::codecFor Name("UTF-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecF orName("UTF-8"));

However I do not use tr() function and I supose that only last line should be suffice (but it is not).

wysota
29th August 2010, 11:36
Please show us an example of your code using national characters.

jmj
6th September 2010, 15:22
I wrote simple app that shows this problem. I think this is due to global variables initialize before "main" execution.