title: how can C++ wcout utf-16 encoded char array?
body: <p>I am reading the well-known <a href="https://stackoverflow.com/questions/402283/stdwstring-vs-stdstring">answer</a> about string and wstring and come up some confusion.  </p>
  
  <p>source charset and execution charset are all set as utf-8, Windows x64, VC++ compiler, git bash console (can print unicode characters), system default codepage 936(GB2312).</p>
  
  <p>My expertiment code:</p>
  
  <pre><code>#include &lt;cstring&gt;
  #include &lt;iostream&gt;
  using namespace std;
  int main(int argc, char* argv[])
  {
      wchar_t c[] = L"olé";
      wchar_t d[] = L"abc";
      wcout &lt;&lt; c &lt;&lt; endl;
      wcout &lt;&lt; d &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>Can print "abc" but can't print "é".</p>
  
  <p>I understand that <code>wchar_t</code> is used along with <code>L</code> prefix string literal. And under Windows <code>wchar_t</code> is encoded with UTF-16(It's hard coded right? No matter what source charset or execution charset I choose, <code>L"abc"</code> would always have the same UTF-16 code units). </p>
  
  <p>The question is：How can it <code>wcout</code> a UTF-16 encoded string("abc"), while my source file is utf-8 and execution charset is utf-8. The program should not be able to recognize UTF-16 encoded stuff unless I set everything to utf-16. </p>
  
  <p>And if it can print UTF-16 in some way, then why can't it print <code>é</code>? </p>