使用以下代码可将代码页字符集更改为utf-8:
system("chcp 65001");
效果对比
使用之前:
#include <iostream>
using namespace std;
int main(){
cout << "hello" << endl;
cout << "你好中国" << endl;
return 0;
}
使用之后:
#include <iostream>
using namespace std;
int main(){
system("chcp 65001");
cout << "hello" << endl;
cout << "你好中国" << endl;
return 0;
}