Windows QT Creator Chinese running garbled problem solving
When I use QT Creator for development under Windows, I suddenly encountered the problem of garbled Chinese characters after running.
I found many ways to do it. After many tests and researches, we now record a method that can be used by ourselves.
first step
Add in the first line of the code file that needs Chinese:
#pragma execution_character_set("utf-8")
Other information on the Internet generally gives this method. At this time, you can test it first to see if it is resolved. If it is not resolved, then continue to the second step.
Second step
Use the Notepad that comes with Windows to open the code file you want to solve the Chinese garbled problem, such as: test.cpp.
Then choose:
文件 --> 另存为 --> 保存类型(所有文件) --> 编码(带有 BOM 的UTF-8) --> 保存
As shown in the figure:
Then use Qt Creator to reload it.
vs QT is not tested, you can try it if you need it.