wprintf輸出中文

淺析 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");

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章