qt5 issues vs the Chinese garbled

Copyright: original articles without consent, is prohibited reprint https://blog.csdn.net/zmlovelx/article/details/83929453

Solution:

It requires several steps

1 with a first open editplus source text editor, save as utf-8 BOM encoding format.

2 QApplication a (argc, argv); preceded QTextCodec :: setCodecForLocale (QTextCodec :: codecForName ( "UTF8"));

3 Chinese wrap with QString :: fromLocal8Bit ( "Chinese").

4 added to the code is in Chinese

#if _MSC_VER >= 1600
#pragma execution_character_set("utf-8")
#endif

  

Guess you like

Origin blog.csdn.net/zmlovelx/article/details/83929453