Home  >  Article  >  Operation and Maintenance  >  How to modify the character set in linux

How to modify the character set in linux

青灯夜游
青灯夜游Original
2022-01-05 17:59:215901browse

Methods to modify the character set: 1. Directly set "export LANG=required character set"; 2. Open the "/etc/sysconfig/i18n" file and set "LANG="required character set" SYSFONT ="latarcyrheb-sun16".

How to modify the character set in linux

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

1. Check the character set

Common methods:

(1)

[root@devhxyw03 ~]# echo $LANG zh_CN.GBK

(2)

[root@devhxyw03 ~]# env | grep LANG LANG=zh_CN.GBK

(3)

[root@devhxyw03 ~]# export | grep LANG declare -x LANG="zh_CN.GBK"

(4)

[root@devhxyw03 ~]# 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=

2. Modify the character set

(1) Modify by directly setting variables, which only works for the temporary shell

export LANG=zh_CN.UTF-8

(2) Modify the file , by modifying the /etc/sysconfig/i18n file control, it will be permanently effective for this machine

[root@devhxyw03 ~]# vim /etc/sysconfig/i18n

LANG="zh_CN.GBK" SYSFONT="latarcyrheb-sun16" 
~ ~~[root@devhxyw03 ~]# source /etc/sysconfig/i18n

(3) Modify the .bash_profile file in the current user’s home directory, and source the file to take effect, and it will be permanently effective for the current user

export LANG=zh_CN.UTF-8

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of How to modify the character set in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn