title: International UTF-32 strings output to console in Linux
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;iostream&gt;
  #include &lt;locale&gt;
  
  int main()
  {
      const wchar_t *str = L"\u041F\u043E\u0440\u044F\u0434\u043E\u043A";
      std::locale::global(std::locale(""));
      std::wcout &lt;&lt; str &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>Here's a piece of code that outputs a russian phrase in UTF-32 wchar_t string as:</p>
  
  <ul>
  <li>The correct one: <strong>Порядок</strong> when run from UTF-8 gnome terminal in Ubuntu 11.10</li>
  <li>РџРѕСЂСЏРґРѕРє in Eclipse in the test run as above</li>
  <li>45=B8D8:0B>@ in Eclipse in a real program (where I don't even know who does what and where, but I suppose someone does mess with locales)</li>
  <li>??????? if I don't call locale</li>
  <li>str is shown as Details:0x400960 L"\320\237\320\276\321\200\321\217\320\264\320\276\320\272" in Eclipse Watch window</li>
  <li>is shown as ASCII only <em>byte chars</em> in Eclipse memory window (and there's no way to specify that this is UTF-32 string)</li>
  </ul>
  
  <p>I believe this is a misconfiguration in either eclipse console or the program, because, for example, other people that just run my code in Eclipse they do <a href="http://www.linux.org.ru/forum/development/7161984?cid=7163441" rel="nofollow">see</a> the correct <a href="http://i27.fastpic.ru/big/2011/1222/27/d347892b3d2750e14ab2717a55122727.png" rel="nofollow">output</a>.</p>
  
  <p>Could someone shed a light on this confusion? What is the correct way to setup all the pieces (OS, gcc, terminal, Eclipse, sources...) to output international symbols that are stored in UTF-32 wchar_t strings?</p>
  
  <p>And as a side note, why should I still care about all this when we have UTF-32 and that should be enough to know what is inside...</p>