title: Console output in cmd.exe, and powershell.exe through C++
body: <p>I know a simple way for correct displaying of localized chars on <code>Cmd.exe</code>. But how can I do same for <code>Powershell.exe</code>?</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;windows.h&gt;
  
  using namespace std;
  int main()
  {
      SetConsoleCP(GetACP());
      SetConsoleOutputCP(GetACP());
  
      // valid output in cmd.exe, 
      // but invalid output in powershell.exe
      cout &lt;&lt; "Привет мир (1)!" &lt;&lt; endl; 
  
      // invalid output in both variants: cmd.exe, 
      // and powershell.exe
      wcout &lt;&lt; L"Привет мир (2)!" &lt;&lt; endl; 
  
      return 0;
  }
  </code></pre>