wprintf输出中文

来源:互联网 发布:国画蝈蝈扇面淘宝价 编辑:程序博客网 时间:2024/05/22 14:19

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

原创粉丝点击