现在的位置: 首页 > 综合 > 正文

Solaris 更改系统语言

2012年05月04日 ⁄ 综合 ⁄ 共 1584字 ⁄ 字号 评论关闭

 

在虚拟机上装了一个Solaris的系统, 不过用客户端进行连接的时候出现了乱码, google 了一下, 问题搞定了。 故整理一下,以后备用。 


1. 语言环境包括语言规范、地域、代码集和其它特征。简体中文 Solaris 操作环境包括下列语言环境:


C--对英文 ASCII 环境,该语言环境必须设置为 C。
zh--对简体中文 EUC 环境,该语言环境必须设置为 zh。
zh.GBK--对简体中文 GBK 环境,该语言环境必须设置为zh.GBK。
zh.UTF-8--对简体中文 Unicode 环境,该语言环境必须设置为zh.UTF-8。


2. 种类是组成语言环境的特征集。例如,字符显示或时间/日期的表达,其性能取决于 语言环境 。 简体中文 Solaris 种类包括下列内容:


LC_CTYPE 设置分类和转换的字符类型。
LC_TIME 设置用于表达日期和时间的语言环境。
LC_NUMERIC 设置数字表达的语言环境(也用于 I/O)。
LC_MONETARY 设置货币表达的语言环境。
LC_MESSAGES 设置给用户的消息的语言环境。
LC_COLLATE 设置取决语言环境的字符串校对。
环境变量 LC_ALL 明确为所有种类设置相同的语言环境;它有最高级优先权。如果种类或 LC_ALL 未设置,则 LANG 环境变量将决定种类设置。


用户可使用 shell 环境变量来改变语言环境设置。每个种类命名一个现有的语言环境。setlocale() 函数直接设置或查询这些种类的设置。国际化的功能使用这些设置来访问所需语言环境相应的表。


环境变量可用以间接设置种类:当 setlocale() 将种类设置为该地点的缺省设定值时,它使用每个环境变量的设定值来设置相关种类。setlocale() 函数不改变环境变量的设定值,只是读取它们的设定值。

3. 示例:
用下列步骤改变系统范围的缺省语言环境。

#chmod u+w /etc/default/init

#vi /etc/default/init

$ cat init

#

# Copyright 1992, 1999-2002 Sun Microsystems, Inc.  All rights reserved.

# Use is subject to license terms.

#

#ident  "@(#)init.dfl   1.7     02/12/03 SMI"

#

# This file is /etc/default/init.  /etc/TIMEZONE is a symlink to this file.

# This file looks like a shell script, but it is not.  To maintain

# compatibility with old versions of /etc/TIMEZONE, some shell constructs

# (i.e., export commands) are allowed in this file, but are ignored.

#

# Lines of this file should be of the form VAR=value, where VAR is one of

# TZ, LANG, CMASK, or any of the LC_* environment variables.  value may

# be enclosed in double quotes (") or single quotes (').

#

TZ=PRC

CMASK=022

LANG=EN //使用英文字体

#LANG=zh_CN.UTF-8  

#LANG=zh.UTF-8 

#:wq

#reboot

 

注: 相关资料来自google. 

抱歉!评论已关闭.