QSettings doesn't handle unicode well

眉间皱痕 提交于 2019-12-01 17:08:25

Check the setIniCodec function of QSettings

Sets the codec for accessing INI files (including .conf files on Unix) to codec. The codec is used for decoding any data that is read from the INI file, and for encoding any data that is written to the file. By default, no codec is used, and non-ASCII characters are encoded using standard INI escape sequences.

So you should call it with the codec you want, eg

QSettings settings;
settings.setIniCodec("UTF-8");

Notice that you must call it immediately after creating the QSettings objects and before accessing any data.

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