我知道正确显示本地化字符的简单方法Cmd.exe
。但是我该怎么做Powershell.exe
呢?
#include<iostream>
#include<windows.h>
using namespace std;
int main()
{
SetConsoleCP(GetACP());
SetConsoleOutputCP(GetACP());
// valid output in cmd.exe,
// but invalid output in powershell.exe
cout << "Привет мир (1)!" << endl;
// invalid output in both variants: cmd.exe,
// and powershell.exe
wcout << L"Привет мир (2)!" << endl;
return 0;
}