にローカライズされた文字を正しく表示する簡単な方法を知ってい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;
}