qt 转码
QTextCodec::ConverterState state;
(图片来源网络,侵删)
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QString msg = codec->toUnicode(readContent, readContent.size(), &state);
if (state.invalidChars > 0)
{
msg = QTextCodec::codecForName("GBK")->toUnicode(readContent);
}
文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。