2 fy1179615810 fy1179615810 于 2017.01.15 17:26 提问

Linux locale全是C 是怎么回事

[root@VM_207_53_centos /]# locale
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"

我看网上全是utf-8 怎么到我这就是c了

1个回答

justin_bkdrong
justin_bkdrong   2017.01.15 18:49

在函数setlocale 有下面的说明文字
The locale argument is a pointer to a string that specifies the name of the locale. If locale points to an empty string, the locale is the implementation-defined native environment. A value of C specifies the minimal ANSI conforming environment for C translation. The C locale assumes that all char data types are 1 byte and that their value is always less than 256.

At program startup, the equivalent of the following statement is executed:

setlocale( LC_ALL, "C" );

说是所有的字符集都是ANSI,假设字符都是1个字节,都小于256

我想这里的配置应该和这个一个意思吧。(我从MSDN 看到了,应该和linux 一样吧。)

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!