Set Qt default encoding to UTF-8

时光怂恿深爱的人放手 提交于 2019-11-30 08:25:10
Anupam Srivastava

setCodecForCStrings() had been deprecated. Try instead,

QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));

It worked for me.

Peter Gulutzan

Regarding the "guess" that "Qt5 assumes all source files are UTF-8 encoded": Thiago Macieira explains the decision made by Qt's developers here.

The assumption can be disabled with QT_NO_CAST_FROM_ASCII according to the documentation.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!