wprintf輸出中文

來源:互聯網
上載者:User

淺析 Linux 的國際化與本地化機制

http://www.ibm.com/developerworks/cn/linux/l-cn-linuxglb/index.html?ca=drs-

如何獲得當前系統的locale呢?包括windowsUNIX

http://bbs.chinaunix.net/viewthread.php?tid=1752378

http://search.cpan.org/~sburke/Win32-Locale-0.04/Locale.pm

  use Win32::Locale;

  my $language = Win32::Locale::get_language();
  if($language eq 'en-us') {
    print "Wasaaap homeslice!/n";
  } else {
    print "You $language people ain't FROM around here, are ya?/n";
  }
C 使用wprintf,_tprintf 列印簡體中文的方法 【Locale.h】

http://www.cnblogs.com/niuniu502/archive/2009/02/17/1392636.html

淺談C中的wprintf和寬字元顯示

http://blog.csdn.net/lovekatherine/archive/2007/11/06/1868724.aspx

 

下面是一些測試代碼:

          printf("/t-?/t/t/t/tFor Help/n");

         printf("中文測試/n");

         //setlocale(LC_ALL,"zh_CN.UTF-8");

         setlocale(LC_ALL,"chs");

         wprintf(L"中文測試/n");

         printf("w0:%ls/n",L"中文測試");

         wprintf(L"w1:%s/n",L"1中文測試 寬字元");

         wprintf(L"w2:%ls/n",L"2中文測試 寬字元");

         wprintf(L"w3:%ls/n",L"3tDirectory 中文測試 寬字元 end");

         wprintf(L"w4:%S/n",L"4 中文測試 寬字元 end");

         printf("w5:%S/n",L"中文測試/n");

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.