Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the different of zh_CN.UTF-8 and en_US.UTF-8 in *nix locale setting?

Tags:

unix

utf-8

When working on *nix system, I always set the locale as en_US.UTF-8, and then this can help me display the Chinese correctly on the stdout.

But I know that there is also zh_CN.UTF-8 for locale setting as well, so I want to know:
What the the different of them?
When should I use zh_CN.UTF-8 or en_US.UTF-8?

like image 974
nevesly Avatar asked Oct 26 '25 05:10

nevesly


1 Answers

Having zero knowledge about zh in itself, changing between the two locales you mentioned may change how certain characters are treated at a word boundary and how different programs produce output.

For example LC_CTYPE=zh_CN.UTF-8 will most likely consider characters with accent marks as "being part of a word" whereas LC_CTYPE=en_US.UTF-8 might not consider those being part of a word.

Same goes for date and currency formats. As I'm pretty sure zh will have different date/currency format than us.

To give you a concrete example, here is what I get from date(1) with two different locales in a relatively recent Ubuntu GNU/Linux system:

user@devbook:~$ LC_TIME=fi_FI.UTF-8 date
to 16.1.2014 07.14.36 +0200
user@devbook:~$ LC_TIME=en_US.UTF-8 date
Thu Jan 16 07:14:42 EET 2014