Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify character set by linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to modify the character set in linux". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to modify the character set in linux".

Modification methods: 1, open the "/ etc/sysconfig/i18n" file; 2, modify the values of "LANG", "SUPPORTED", "SYSFONT" items; 3, save and exit the file; 4, execute the "# source / etc/sysconfig/i18n" command.

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

First, view the character set

The character set is represented as an environment variable in the system, and there are several ways to view the character set used by the current terminal:

Method 1

# echo $LANGen_US.UTF-8

Method 2

# env | grep LANGLANG=en_US.UTF-8

Method 3

# export | grep LANGdeclare-x LANG= "en_US.UTF-8"

Method 4

# locale-a / / View the local character set # locale-m / / View all supported character sets

The difference between set,env and export

Set displays variables for the current shell, including variables for the current user

Env displays variables for the current user

Export displays shell variables that are currently exported as user variables

Set is used to display local variables

Env is used to display environment variables

Export is used to display and set environment variables

For example, set user LANG

View LANG env | grep LANG

Set up LANG export LANG=zh_CH.GBK

Second, the way to modify the character set

It should be noted that if the default language is en_US.UTF-8, it is impossible to display and enter Chinese under the character and graphical interface of Linux. If the default language is Chinese, such as zh_CN.GB18030 or

Zh_CN.gb2312, character interface can not be displayed and input, graphical interface can.

There are two ways to modify it:

1. Modify the way to set variables directly. The following two commands are used:

# LANG=xxx or export LANG=xxx; # LC_ALL= "xxx" or export LC_ALL= "xxx"

Note: xxx is the character set to be modified

The locale-a command is used to view the standard character set, such as zh_CN.GB2312, zh_CN.GB18030 or zh_CN.UTF-8, en_US.UTF-8, etc., but the above modification method will only take effect in the current shell, and the new shell environment variable will disappear.

Therefore, there is no garbled code when logging in to the system to execute the command "LANG=", which means canceling the display of the character set.

Canceling the character set can also execute the command [root@ ~] # unset LANG.

2. Modify the file method and control it through configuration / etc/sysconfig/i18n file

# vim / etc/sysconfig/i18nLANG= "en_US.UTF-8" / / current system locale variable SUPPORTED= "zh_CN.UTF-8:zh_CN.GB18030" / / which language support is preset by the system Languages that are not in the project cannot display SYSFONT= "latarcyrheb-sun16" / / define console terminal fonts The font that appears when you log in is this latarcyrheb-sun16.

After the modification file is saved and exited, it is necessary to execute the following command before restart can take effect.

# source / etc/sysconfig/i18n Thank you for your reading, the above is the content of "how to modify the character set of linux". After the study of this article, I believe you have a deeper understanding of how to modify the character set of linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report