LC_ALL=C的含义
在Linux中通过locale来设置程序运行的不同语言环境,locale由ANSI C提供支持。locale的命名规则为<语言>_<地区>.<字符集编码>,如zh_CN.UTF-8,zh代表中文,CN代表大陆地区,UTF-8表示字符集。
在locale环境中,有一组变量,代表国际化环境中的不同设置:
1. LC_COLLATE
定义该环境的排序和比较规则
2. LC_CTYPE
用于字符分类和字符串处理,控制所有字符的处理方式,包括字符编码,字符是单字节还是多字节,如何打印等。是最重要的一个环境变量。
3. LC_MONETARY
货币格式
4. LC_NUMERIC
非货币的数字显示格式
5. LC_TIME
时间和日期格式
6. LC_MESSAGES
提示信息的语言。另外还有一个LANGUAGE参数,它与LC_MESSAGES相似,但如果该参数一旦设置,则LC_MESSAGES参数就会失效。LANGUAGE参数可同时设置多种语言信息,如LANGUANE="zh_CN.GB18030:zh_CN.GB2312:zh_CN"。
7. LANG
LC_*的默认值,是最低级别的设置,如果LC_*没有设置,则使用该值。类似于 LC_ALL。
8. LC_ALL
它是一个宏,如果该值设置了,则该值会覆盖所有LC_*的设置值。注意,LANG的值不受该宏影响。
"C"是系统默认的locale,"POSIX"是"C"的别名。所以当我们新安装完一个系统时,默认的locale就是C或POSIX。
"POSIX" :Specifies the minimal environment for C-language translation called the POSIX locale. If setlocale() is not invoked, the POSIX locale is the default"C" Equivalent to "POSIX".-----------------------------------
* As a user-specific locale
* As a system default locale
To change the current locale setting, first confirm that the desired locale is
installed on the system with:
# locale -a
de
en_AU
en_CA
en_UK
C
If the desired locale is not in the list, you will need to install the
appropriate packages for that locale. See the Note below for more information
about locale packages.
On the CDE login banner:
Choose options - languages
Under languages - choose the new locale
The CDE banner will re-cycle and then you can login to the selected locale.
NOTE: If a user has a different default locale set in their environment, the
that locale setting will override the selected CDE login locale.
For sh, ksh:
# LANG=C; export LANG
# LC_ALL=C; export LC_ALL
For csh:
# setenv LANG C
# setenv LC_ALL C
Note: To set a default locale for a user's environment, set the LANG or LC_*
variables in a user's shell intialization file such as $HOME/.profile or
$HOME/.cshrc
How to change the locale by setting the system default locale?
LANG=C
LC_ALL=C Example from the /etc/default/init file: # Lines of this file should be of the form VAR=value, where VAR is one of
# TZ, LANG, or any of the LC_* environment variables.
LANG=C
LC_ALL=C Note: The system must be rebooted after making changes to the
/etc/default/init file in order for the changes to take effect. How to verify the locale setting?
After setting or changing the locale, verify that the locale is set correctly:
Check if the locale is set correctly by running the locale command without any
options:
# locale
LANG=C
LC_CTYPE= "C"
LC_NUMERIC= "C"
LC_TIME= "C"
LC_COLLATE= "C"
LC_MONETARY= "C"
LC_MESSAGES= "C"
LC_ALL=C Locale是某一个地域内的人们的语言习惯和文化传统和生活习惯,是根据计算机用户所使用的语言,所在国家或者地区,以及当地的文化传统所定义的一个软件运行时的语言环境。
Locale是软件在运行时的语言环境, 它包括语言(Language), 地域 (Territory) 和字符集(Codeset)。一个locale的书写格式为: 语言[_地域[.字符集]]。完全的locale表达方式是 [语言[_地域][.字符集] [@修正值]。zh_CN.GB2312=中文_中华人民共和国+国标2312字符集。 locale的设定:
LC_ALL和LANG优先级的关系: LC_ALL > LC_* >LANG
1、如果需要一个纯中文的系统的话,设定LC_ALL= zh_CN.XXXX,或者LANG=zh_CN.XXXX都可以。
2、如果只想要一个可以输入中文的环境,而保持菜单、标题,系统信息等等为英文界面,那么只需要设定 LC_CTYPE=zh_CN.XXXX,LANG=en_US.XXXX就可以了。
3、假如什么也不做的话,也就是LC_ALL,LANG和LC_*均不指定特定值的话,系统将采用POSIX作为lcoale,也就是C locale。
LANG和LANGUAGE的区别:
LANG - Specifies the default locale for all unset locale variables
LANGUAGE - Most programs use this for the language of its interface
LANGUAGE是设置应用程序的界面语言。而LANG是优先级很低的一个变量,它指定所有与locale有关的变量的默认值
LC_ALL=C的含义的更多相关文章
- shell学习笔记
shell学习笔记 .查看/etc/shells,看看有几个可用的Shell . 曾经用过的命令存在.bash_history中,但是~/.bash_history记录的是前一次登录前记录的所有指令, ...
- Ubuntu18.04 使用过程遇到的问题记录
索引: 1.Ubuntu 18.04 安装搜狗输入法 2.在 Ubuntu 18.04 中将第三方软件添加至 favorite 菜单栏 3.在 VMware workstation 中为虚拟机安装 V ...
- bug宝典linux篇 LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory(转)
升级glibc库后,使用xShell登录linux,提示: Connecting to ... Connection established. To escape to local shell, pr ...
- linux下locale中的各环境变量的含义
本文来自:http://blog.sina.com.cn/s/blog_406127500101dk26.html Locale是软件在运行时的语言环境, 它包括语言(Language), 地域 (T ...
- 【转载】Linux字符集和系统语言设置-LANG,locale,LC_ALL,POSIX等命令及参数详解
Linux字符集和系统语言设置-LANG,locale,LC_ALL,POSIX等命令及参数详解 1清风揽月10人评论5006人阅读2017-06-21 15:48:43 博文说明[前言]: 本文 ...
- Linux的locale、LC_ALL和LANG
如果你是一个Linux新手,并且刚刚安装了一个新的英文系统但想要设置成中文系统,肯定会接触到上面几个变量,在网上搜索了一系列解决方法,给一些变量赋一下值,再export一下,或者写到配置文件里面,然后 ...
- 由css reset想到的深入理解margin及em的含义
由css reset想到的深入理解margin及em的含义 原文地址:http://www.ymblog.net/content_189.html 经常看到这样语句,*{ margin:0px;pad ...
- Stack的三种含义
作者: 阮一峰 日期: 2013年11月29日 学习编程的时候,经常会看到stack这个词,它的中文名字叫做"栈". 理解这个概念,对于理解程序的运行至关重要.容易混淆的是,这个词 ...
- wireshark抓包工具简介以及tcp三次握手的一些含义
wireshark是非常流行的网络封包分析软件,功能十分强大.可以截取各种网络封包,显示网络封包的详细信息.使用wireshark的人必须了解网络协议,否则就看不懂wireshark了.为了安全考虑, ...
随机推荐
- 用php实现交互式工具——How do I write a command-line interactive PHP script?
I want to write a PHP script that I can use from the command line. I want it to prompt and accept in ...
- Kafka:ZK+Kafka+Spark Streaming集群环境搭建(九)安装kafka_2.11-1.1.0
如何搭建配置centos虚拟机请参考<Kafka:ZK+Kafka+Spark Streaming集群环境搭建(一)VMW安装四台CentOS,并实现本机与它们能交互,虚拟机内部实现可以上网.& ...
- LogCat用法2
如果adb devices显示设备的状态是offline, 这是可以看手机的通知栏,会有一个"触摸以设置USB"这样一个类似的提示,触摸它以后会要求你选择USB的用途,选择第二个' ...
- oauth2-server-php-docs 授权控制器
授权控制器 概观 对于授权端点,要求用户使用authorization code(授权码授权类型)或access token(隐式授权类型)对客户端进行认证和重定向. 方法 handleAuthori ...
- 【iOS地图开发】巧妙打造中英文全球地图
地图开发的同学们经常遇到这样的问题,国内版地图开发,用高德或者百度就行了.但是,国外的地图怎么办?这里告诉大家,如果利用iOS地图,打造中英文的,国内国外都能用的,全球地图. 制作全英文地图的展示并不 ...
- SQL从一个表查询数据插入/更新到另一个表
示例一: 从数据库表A中查询出数据插入到数据库表B 从数据库DataBaseA的表TDA中查询出数据插入到数据库DataBaseB的表TDB insert into [DataBaseA].[dbo] ...
- idea maven项目如何使用lib下得jar包
在项目开发中,一般使用maven来管理项目,但有时还需要引用本地lib下的jar包 比如,中央仓库没有jar包.这时我们就需要引入lib下的jar包了. 1.首先在dependencies里加入本地j ...
- The Builder pattern simulates named optional parameters(Java)
the Builder pattern is a good choice when designing classes whose constructors or static factories w ...
- 【Shell】Linux的判断表达式:-d,-f,-e等
文件比较运算符 表达式 说明 案例 -e filename 如果filename存在,则为真 [ –e /et ...
- Linux之压缩与解压缩
一.解压缩: tar –xvf file.tar //解压 tar包 tar -xzvf file.tar.gz //解压tar.gz tar -xjvf file.tar.bz2 //解压 tar. ...