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 the default Encoding in Linux system

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

Share

Shulou(Shulou.com)06/01 Report--

Linux system how to modify the default code, many novices are not very clear, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

First, the default coding setting of Linux system.

/ etc/sysconfig/i18n

Controls the system font settings. The language variables are used in / etc/profile.d/lang.sh. An example i18n file:

LANG= "zh_CN.GB18030"

LANGUAGE= "zh_CN.GB18030:zh_CN.GB2312:zh_CN"

SUPPORTED= "zh_CN.GB18030:zh_CN:zh:en_US.UTF-8:en_US:en"

SYSFONT= "lat0-sun16"

Above is to set the default character set of the system to GB2312. The default coded character set for many systems is UTF-8. You can change the default character set of the system by setting this file.

In addition, you can add the declaration of the path variable to the user's environment variable or the user's environment variable file:

Declare in the system's preprocessing file, which works for the entire system:

# vi / etc/profile

Add at the end of the file

LC_ALL= "zh_CN.GBK"

Export LANG= "zh_CN.GBK"

Declare in the user's preprocessing file that it works for individual users:

# vi / root/.bash_profile

Add at the end of the file

Export LC_ALL= "zh_CN.GBK"

Export LANG= "zh_CN.GBK"

The above configuration restarts the server for the changes to take effect.

Second, view the current character set of the system.

Locale:local encode, which means local coding. This command displays the character set encoding of the current system without any arguments. You can also set the environment variable, all parameters man locale

Third, install fonts.

# mkdir folder where fonts are stored

# cp * .ttf the folder you just created

Generate fonts.dir file

# ttmkfdir > fonts.dir

Note: mkfontdir is used to generate fonts.dir files for dot matrix fonts, and ttmkfdir is used to generate fonts.dir files for TrueType fonts. Because ttmkfdir can not recognize the code of some Chinese characters TTF, it needs to be modified manually.

The generated fonts.dir is as follows:

Fonts.dir

=

Simsun.ttf-misc-SimSun-medium-r-normal-0-0-0-0-p-0-ascii-0

Change to:

Simsun.ttf-misc-SimSun-medium-r-normal-0-0-0-0-p-0-gb2312.1980-0

Generate fonts.alias file

# cat fonts.dir > fonts.alias

Change the fonts.alias content to:

SimSun- misc-SimSun-medium-r-normal-0-0-0-0-p-0-gb2312.1980-0

Add the path of the font to the FontPath

# vi / etc/X11/XF86Config

Add the path you just created to this file

# step

The path just created by # fc_cache forces the font cache to be flushed to make the font effective.

Fourth, vim coding.

Encoding this option is used for buffered text (the file you are editing), registers, Vim script files, etc. You can think of the 'encoding' option as a setting for the internal operating mechanism of Vim.

Fileencoding this option is the type of encoding that vim uses when writing to the file.

Termencoding this option represents the type of encoding used for output to the customer terminal (Term).

The default values of these three variables:

The encoding is the same as the current locale of the system, so consider the current locale when editing the file, otherwise there will be more things to set.

When fileencodingvim opens a file, it automatically recognizes its encoding, and fileencoding is the recognized value. If it is empty, the file is saved with the encoding encoding. If the encoding is not modified, the value is the current locale of the system.

The default value of termencoding is null, that is, the output to the terminal is not converted.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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

Development

Wechat

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

12
Report