歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Unix知識 >> Unix基礎知識 >> Solaris中如何更改系統語言

Solaris中如何更改系統語言

日期:2017/3/3 15:20:05   编辑:Unix基礎知識

在虛擬機上裝了一個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 設置取決語言環境的字符串校對。

查看本欄目更多精彩內容:http://www.bianceng.cn/OS/unix/

環境變量 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

Copyright © Linux教程網 All Rights Reserved