title: Console Printing of string and wstring in C++
body: <p>I can see there are many questions related to strings and wide strings. But as none of them gives me information I am looking for... I am posting a new question.</p>
  
  <p>I have this code... </p>
  
  <pre><code>std::string myName("vikrant");
  std::cout&lt;&lt;myName&lt;&lt;std::endl;
  
  std::wstring myNameHindi = L"मुरुगन";
  std::wcout&lt;&lt;myNameHindi&lt;&lt;"-----"&lt;&lt;myNameHindi.size()&lt;&lt;std::endl;
  std::wcout&lt;&lt;L"मुरुगन"&lt;&lt;std::endl;
  
  std::string myNameHindiS = "मुरुगन";
  std::cout&lt;&lt;myNameHindiS&lt;&lt;"-----"&lt;&lt;myNameHindiS.size()&lt;&lt;std::endl;
  </code></pre>
  
  <p>when I compile &amp; run this code on my RHEL box(... (connected through ssh, running gcc 4.1.2)  I get this o/p (please note middle two lines are not printing properly)</p>
  
  <pre><code>vikrant
  .A0A(-----6
  .A0A(
  मुरुगन-----18
  </code></pre>
  
  <p>While on my apple laptop and one of FreeBSD(through ssh) box I dont get o/p from w_* code.  I just get first and last cout executed
      vikrant
      मुरुगन-----18</p>
  
  <p>My understanding was that if not specified these strings will be treated as UTF 8. and if string can handle it wstring will handle as well. Is there something wrong in that approach?
  Some addon questions are...
  is it just a display problem? or wstring is not reliable on linux?
  Any additional information may help as well.</p>