title: output utf8 in console with Visual Studio (wide stream)
body: <p>This piece of code works if i compiled it with mingw32 on windows 10.
  and emits right result, as you can see below :</p>
  
  <pre><code>C:\prj\cd&gt;bin\main.exe
  1°à€3§4ç5@の,は,でした,象形字 ;
  </code></pre>
  
  <p>Indeed when i try to compile it with Visual Studio 17, same code emits wrong chracters</p>
  
  <pre><code>/out:prova.exe
  prova.obj
  
  C:\prj\cd&gt;prova.exe
  1Â°Ã â‚¬3Â§4Ã§5@ã®,ã¯,ã§ã—ãŸ,è±¡å½¢å­— ;
  
  C:\prj\cd&gt;
  </code></pre>
  
  <p>here source code :</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;io.h&gt;
  #include &lt;fcntl.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;string&gt;
  #include &lt;iostream&gt;
  
  int main ( void )
  {
      _wsetlocale(LC_ALL, L"it_IT.UTF-8" );   // set locale wide string
      _setmode(_fileno(stdout), _O_U8TEXT);   // set Locale for console
      SetConsoleCP( CP_UTF8 ) ;               
      SetConsoleOutputCP(CP_UTF8);
  
      // Enable buffering to prevent VS from chopping up UTF-8 byte sequences
      setvbuf(stdout, nullptr, _IOFBF, 1000);
  
      std::wstring test = L"1°à€3§4ç5@の,は,でした,象形字 ;";
      std::wcout &lt;&lt; test &lt;&lt; std::endl;
  
  }
  </code></pre>
  
  <p>I have read several topics :</p>
  
  <p><a href="https://stackoverflow.com/questions/45575863/how-to-print-utf-8-strings-to-stdcout-on-windows/45588456">How to print UTF-8 strings to std::cout on Windows?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/38994511/how-to-make-stdwofstream-write-utf-8">How to make std::wofstream write UTF-8?</a></p>
  
  <p>and many others, but somehtins goes wrong ... 
  can you help me ?</p>