SUSE Linux编码问题


Linux字符编码默认为UTF-8,如出现乱码可设置为GBK

1.手动更改profile文件的命令:
vi /etc/profile

2.在文件的末尾添加以下两行命令:
export LC_ALL="zh_CN.GBK"
export LANG="zh_CN.GBK"

需要的配置主要有:
en_US.UTF-8 UTF-8

en_US ISO-8859-1
zh_CN GB2312
zh_CN.GB18030 GB18030
zh_CN.GBK GBK
zh_CN.UTF-8 UTF-8
默认为en_US.UTF-8 UTF-8

3.也可在/root/.bash_profile文件的末尾添加以下两行命令:
export LC_ALL="zh_CN.GBK"
export LANG="zh_CN.GBK"

重新启动服务器使更改生效。

4.修改成功以后用locale命令查看,修改前的默认设置为:
# locale
LANG=en_US.UTF-8
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX "
LC_MESSAGES="POSIX "
LC_PAPER="POSIX "
LC_NAME="POSIX "
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX "
LC_MEASUREMENT="POSIX "
LC_IDENTIFICATION="POSIX "
LC_ALL=

5.修改成功以后的配置为:
# locale
LANG=zh_CN.GBK
LC_CTYPE="zh_CN.GBK
LC_NUMERIC="zh_CN.GBK "
LC_TIME="zh_CN.GBK "
LC_COLLATE="zh_CN.GBK
LC_MONETARY="zh_CN.GBK "
LC_MESSAGES="zh_CN.GBK "
LC_PAPER="zh_CN.GBK "
LC_NAME="zh_CN.GBK "
LC_ADDRESS="zh_CN.GBK "
LC_TELEPHONE="zh_CN.GBK "
LC_MEASUREMENT="zh_CN.GBK "
LC_IDENTIFICATION="zh_CN.GBK "
LC_ALL=zh_CN.GBK

你可能感兴趣的:(linux)