# Include <qapplication>
# Include <qlabel>
# Include <qtextcodec>
Int main (INT argc, char ** argv)
{
Qapplication app (argc, argv );
Qtextcodec * codec = qtextcodec: codecforname ("gb2312 ");
Qtextcodec: setcodecforlocale (codec );
Qtextcodec: setcodecforcstrings (codec );
Qtextcodec: setcodecfortr (codec );
Qlabel label ("the same world, the same dream! "));
Label. Show ();
Return app.exe C ();
}
Solve Chinese garbled characters in ini files
Qsettings settings ("XXXX. ini", qsettings: iniformat );
Settings. setinicodec (qtextcodec: codecforname ("gb2312"); // Add settings here to read and write the Chinese characters in the INI file.
Settings. begingroup ("company ");
Solve Chinese garbled characters for reading Chinese files
Qfile file ("xxxx.txt ");
Qtextstream stream (file, qiodevice: readonly );
Stream. setcodec (qtextcodec: codecforname ("gb2312 "));
Stream. readall ();