我的项目中所有显示的文本都是希腊语。我没有使用tr()
,直接使用希腊字符。对于我使用的正确编码:
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("ISO 8859-7"));//for Greek
Qt5拿走setCodecForCStrings
了,所有的字符都显示为"???????"
。有解决方法吗?
请注意这是一个大项目,我想避免对程序中的每个字符串都使用代码。
Thank you Esailija
So saving all my files with UTF-8 encoding solved the problem.
If you are using Qt Creator, change the default encoding to UTF-8:
Preferences -> Text Editor -> Default Encoding ... choose UTF-8
Then for the existing files go to Edit->Select Encoding and change it to UTF-8
also for anyone wanting more details look here http://www.macieira.org/blog/2012/05/source-code-must-be-utf-8-and-qstring-wants-it/