clion 中文乱码

1.终端乱码: 双击Shit,跳出搜索界面,输入Registry,点击进入。 去掉“run.processes.with.pty”中默认的对勾,不要勾选该选项,close退出。 运行程序,中文显示正常。 clion 发布exe 中文乱码 #include <iostream> #include <windows.h> int main() { // 设置控制台输出为 UTF-8 SetConsoleOutputCP(CP_UTF8); // 确保读取控制台输入也为 UTF-8 SetConsoleCP(CP_UTF8); std::wcout.imbue(std::locale("chs")); // 对于宽字符输出,使用中文语言环境 std::wcout << L"你好,世界!" << std::endl; return 0; }