title: C++ crash when use setmode with _O_U8TEXT to deal with unicode
body: <p>What I've tried to print unicode is</p>
  
  <pre><code>_setmode(_fileno(stdout), _O_U8TEXT);
  string str = u8"unicode 한글 hangul";
  cout &lt;&lt; str &lt;&lt; endl;
  </code></pre>
  
  <p>I used setmode to show and get unicode correctly, but It crashed with <a href="https://i.stack.imgur.com/hpdjN.png" rel="nofollow noreferrer">Debug Assertion Fail</a>.</p>
  
  <p>However,</p>
  
  <pre><code>_setmode(_fileno(stdout), _O_U16TEXT);
  wstring str = L"unicode 한글 hangul";
  wcout &lt;&lt; str &lt;&lt; endl;
  </code></pre>
  
  <p>_O_U16TEXT compile and print correctly.</p>
  
  <p>What should I do to use UTF-8? Do I have to find another trick?</p>