<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic std::wcout not working in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850060#M98111</link>
    <description>&lt;BR /&gt;Host: HP-UX artemis B.11.11 U 9000/800 2599003817&lt;BR /&gt;Compiler: aCC: HP ANSI C++ B3910B A.03.73&lt;BR /&gt;locale: zh_CN.utf8&lt;BR /&gt;&lt;BR /&gt;Wide character string containing UTF-16 characters does not display on std::wcout but works fine when I use printf with %S.&lt;BR /&gt;&lt;BR /&gt;#include &lt;IOSTREAM&gt;&lt;BR /&gt;#include &lt;LOCALE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;    setlocale(LC_ALL,"");&lt;BR /&gt;    wchar_t real[25]    = {0};&lt;BR /&gt;&lt;BR /&gt;// Original UTF-16 used for checking.&lt;BR /&gt;    real[0]     = 0x003C;&lt;BR /&gt;    real[1]     = 0x65F6;&lt;BR /&gt;    real[2]     = 0x95F4;&lt;BR /&gt;    real[3]     = 0xFF08;&lt;BR /&gt;    real[4]     = 0x7992;&lt;BR /&gt;    real[5]     = 0xFF09;&lt;BR /&gt;    real[6]     = 0x003E;&lt;BR /&gt;    real[7]     = 0x005D;&lt;BR /&gt;    real[8]     = 0x0000;&lt;BR /&gt;&lt;BR /&gt;    char    src[25]     = {0};&lt;BR /&gt;// UTF-8 to mach expected output for UTF8 local&lt;BR /&gt;&lt;BR /&gt;    src[0]      = 0x3c;     // 0x003c&lt;BR /&gt;&lt;BR /&gt;    src[1]      = 0xE6;     // 0x65F6&lt;BR /&gt;    src[2]      = 0x97;&lt;BR /&gt;    src[3]      = 0xB6;&lt;BR /&gt;&lt;BR /&gt;    src[4]      = 0xE9;     // 0x95F4&lt;BR /&gt;    src[5]      = 0x97;&lt;BR /&gt;    src[6]      = 0xB4;&lt;BR /&gt;&lt;BR /&gt;    src[7]      = 0xEF;     // 0xFF08&lt;BR /&gt;    src[8]      = 0xBC;&lt;BR /&gt;    src[9]      = 0x88;&lt;BR /&gt;&lt;BR /&gt;    src[10]     = 0xE7;     // 0x7992&lt;BR /&gt;    src[11]     = 0xA6;&lt;BR /&gt;    src[12]     = 0x92;&lt;BR /&gt;&lt;BR /&gt;    src[13]     = 0xEF;     // 0xFF09&lt;BR /&gt;    src[14]     = 0xBC;&lt;BR /&gt;    src[15]     = 0x89;&lt;BR /&gt;&lt;BR /&gt;    src[16]     = 0x3E;     // 0x003E&lt;BR /&gt;    src[17]     = 0x5D;     // 0x005D&lt;BR /&gt;    src[18]     = 0x0;&lt;BR /&gt;&lt;BR /&gt;// Using printf&lt;BR /&gt;    printf("s:%s\n",src);&lt;BR /&gt;    printf("S:%S\n",real);&lt;BR /&gt;&lt;BR /&gt;// Output the UTF-8&lt;BR /&gt;&lt;BR /&gt;    std::cout  &amp;lt;&amp;lt; "N:" &amp;lt;&amp;lt; src &amp;lt;&amp;lt; std::endl;&lt;BR /&gt;&lt;BR /&gt;// Output the UTF-16&lt;BR /&gt;    std::wcout &amp;lt;&amp;lt; "W:" &amp;lt;&amp;lt; real &amp;lt;&amp;lt; std::endl;&lt;BR /&gt;&lt;BR /&gt;    return(0);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;ash-3.00# aCC -AA unicodetest.cpp &lt;BR /&gt;&lt;/LOCALE&gt;&lt;/IOSTREAM&gt;</description>
    <pubDate>Thu, 24 Aug 2006 12:38:15 GMT</pubDate>
    <dc:creator>venkata_1</dc:creator>
    <dc:date>2006-08-24T12:38:15Z</dc:date>
    <item>
      <title>std::wcout not working</title>
      <link>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850060#M98111</link>
      <description>&lt;BR /&gt;Host: HP-UX artemis B.11.11 U 9000/800 2599003817&lt;BR /&gt;Compiler: aCC: HP ANSI C++ B3910B A.03.73&lt;BR /&gt;locale: zh_CN.utf8&lt;BR /&gt;&lt;BR /&gt;Wide character string containing UTF-16 characters does not display on std::wcout but works fine when I use printf with %S.&lt;BR /&gt;&lt;BR /&gt;#include &lt;IOSTREAM&gt;&lt;BR /&gt;#include &lt;LOCALE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;    setlocale(LC_ALL,"");&lt;BR /&gt;    wchar_t real[25]    = {0};&lt;BR /&gt;&lt;BR /&gt;// Original UTF-16 used for checking.&lt;BR /&gt;    real[0]     = 0x003C;&lt;BR /&gt;    real[1]     = 0x65F6;&lt;BR /&gt;    real[2]     = 0x95F4;&lt;BR /&gt;    real[3]     = 0xFF08;&lt;BR /&gt;    real[4]     = 0x7992;&lt;BR /&gt;    real[5]     = 0xFF09;&lt;BR /&gt;    real[6]     = 0x003E;&lt;BR /&gt;    real[7]     = 0x005D;&lt;BR /&gt;    real[8]     = 0x0000;&lt;BR /&gt;&lt;BR /&gt;    char    src[25]     = {0};&lt;BR /&gt;// UTF-8 to mach expected output for UTF8 local&lt;BR /&gt;&lt;BR /&gt;    src[0]      = 0x3c;     // 0x003c&lt;BR /&gt;&lt;BR /&gt;    src[1]      = 0xE6;     // 0x65F6&lt;BR /&gt;    src[2]      = 0x97;&lt;BR /&gt;    src[3]      = 0xB6;&lt;BR /&gt;&lt;BR /&gt;    src[4]      = 0xE9;     // 0x95F4&lt;BR /&gt;    src[5]      = 0x97;&lt;BR /&gt;    src[6]      = 0xB4;&lt;BR /&gt;&lt;BR /&gt;    src[7]      = 0xEF;     // 0xFF08&lt;BR /&gt;    src[8]      = 0xBC;&lt;BR /&gt;    src[9]      = 0x88;&lt;BR /&gt;&lt;BR /&gt;    src[10]     = 0xE7;     // 0x7992&lt;BR /&gt;    src[11]     = 0xA6;&lt;BR /&gt;    src[12]     = 0x92;&lt;BR /&gt;&lt;BR /&gt;    src[13]     = 0xEF;     // 0xFF09&lt;BR /&gt;    src[14]     = 0xBC;&lt;BR /&gt;    src[15]     = 0x89;&lt;BR /&gt;&lt;BR /&gt;    src[16]     = 0x3E;     // 0x003E&lt;BR /&gt;    src[17]     = 0x5D;     // 0x005D&lt;BR /&gt;    src[18]     = 0x0;&lt;BR /&gt;&lt;BR /&gt;// Using printf&lt;BR /&gt;    printf("s:%s\n",src);&lt;BR /&gt;    printf("S:%S\n",real);&lt;BR /&gt;&lt;BR /&gt;// Output the UTF-8&lt;BR /&gt;&lt;BR /&gt;    std::cout  &amp;lt;&amp;lt; "N:" &amp;lt;&amp;lt; src &amp;lt;&amp;lt; std::endl;&lt;BR /&gt;&lt;BR /&gt;// Output the UTF-16&lt;BR /&gt;    std::wcout &amp;lt;&amp;lt; "W:" &amp;lt;&amp;lt; real &amp;lt;&amp;lt; std::endl;&lt;BR /&gt;&lt;BR /&gt;    return(0);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;ash-3.00# aCC -AA unicodetest.cpp &lt;BR /&gt;&lt;/LOCALE&gt;&lt;/IOSTREAM&gt;</description>
      <pubDate>Thu, 24 Aug 2006 12:38:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850060#M98111</guid>
      <dc:creator>venkata_1</dc:creator>
      <dc:date>2006-08-24T12:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: std::wcout not working</title>
      <link>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850061#M98112</link>
      <description>Here is a  pic of the output.&lt;BR /&gt;Note that the last line contains no visable characters.</description>
      <pubDate>Thu, 24 Aug 2006 12:55:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850061#M98112</guid>
      <dc:creator>venkata_1</dc:creator>
      <dc:date>2006-08-24T12:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: std::wcout not working</title>
      <link>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850062#M98113</link>
      <description>It appears you can have any color wchar_t you want, as long as it is black.  ;-)&lt;BR /&gt;&lt;BR /&gt;Please contact the Response Center and file a bug report.</description>
      <pubDate>Fri, 25 Aug 2006 21:12:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850062#M98113</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2006-08-25T21:12:40Z</dc:date>
    </item>
    <item>
      <title>Re: std::wcout not working</title>
      <link>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850063#M98114</link>
      <description>I don't know what a "Response Center" center is and I could not find any links, Can you please help where to go(url) or ph # ?</description>
      <pubDate>Mon, 28 Aug 2006 10:54:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850063#M98114</guid>
      <dc:creator>venkata_1</dc:creator>
      <dc:date>2006-08-28T10:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: std::wcout not working</title>
      <link>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850064#M98115</link>
      <description>&amp;gt;I don't know what a "Response Center" center is and I could not find any links, Can you please help where to go(url) or ph #?&lt;BR /&gt;&lt;BR /&gt;You need a support contract.  Is there anyone in your company that knows about that?&lt;BR /&gt;If you have it, there should be links off of the main ITRC page: "remote support and diagnostics"&lt;BR /&gt;&lt;BR /&gt;This page may have some info?&lt;BR /&gt;&lt;A href="http://welcome.hp.com/country/us/en/contact_us.html" target="_blank"&gt;http://welcome.hp.com/country/us/en/contact_us.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Our contact from RW says there are several issues:&lt;BR /&gt;  std::wcout has unspecified behavior. There's no requirement that&lt;BR /&gt;it use codecvt or even what kind of streambuf it should use&lt;BR /&gt;And:&lt;BR /&gt;  The behavior of codecvt&lt;WCHAR_T&gt; is implementation-defined.&lt;BR /&gt;&lt;BR /&gt;So I suppose you should continue to use stdio or call wcstombs if you have some wchar_t strings and want to use cout.&lt;/WCHAR_T&gt;</description>
      <pubDate>Mon, 28 Aug 2006 19:59:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850064#M98115</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2006-08-28T19:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: std::wcout not working</title>
      <link>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850065#M98116</link>
      <description>&lt;!-- !*# --&gt;&lt;P&gt;&amp;gt;Our contact from RW says there are several issues:&lt;BR /&gt;&lt;BR /&gt;Oops, I forgot to mention his solution using imbue:&lt;BR /&gt;typedef std::codecvt_byname ucs2utf;&lt;BR /&gt;std::wcout.imbue(std::locale(std::locale(), new ucs2utf("zh_CN.utf8")));&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2011 03:03:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850065#M98116</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-10-31T03:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: std::wcout not working</title>
      <link>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850066#M98117</link>
      <description>Or simply:&lt;BR /&gt;&lt;BR /&gt;  std::wcout.imbue(std::locale("zh_CN.utf8"));&lt;BR /&gt;&lt;BR /&gt;This way you'll get consistent behavior across all locale categories, including numeric.</description>
      <pubDate>Tue, 29 Aug 2006 12:50:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850066#M98117</guid>
      <dc:creator>Martin Sebor</dc:creator>
      <dc:date>2006-08-29T12:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: std::wcout not working</title>
      <link>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850067#M98118</link>
      <description>Unfortunately Martin's simple fix doesn't work on HP's version of RogueWave stdlib.</description>
      <pubDate>Tue, 29 Aug 2006 21:40:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/std-wcout-not-working/m-p/3850067#M98118</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2006-08-29T21:40:58Z</dc:date>
    </item>
  </channel>
</rss>

