QString 内部采用的是Unicode
#include <QtCore/QTextCodec>
QString fromGBK(const std::string &s)
{
QTextCodec *gbk = QTextCodec::codecForName("GB18030");
return gbk->toUnicode(s.c_str());
}
QString fromUTF8(const std::string &s)
{
QTextCodec *utf8 = QTextCodec::codecForName("UTF-8");
return utf8->toUnicode(s.c_str());
}