Search code examples
locale

How to improve if my Linux locale outputs are all '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"

I have tried to find the answer on some other sites, but I've found that other peoples are mostly "utf-8", but mine are all "C". Can someone help me please? Or just provide a hint? Thanks!


Solution

  • In the function "setlocale" there is the following description text: 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" ); It is said that all character sets are ANSI, assuming that the characters are all 1 byte, all less than 256. I think the configuration here should have the same meaning as this. (I read it from MSDN, maybe it's the same as linux.)