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

On the setting of LINUX language Environment

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

Share

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

Character set errors are common in linux systems. Here's a summary of how to set and modify the system locale.

1. The environment variable LANG is used to set the locale of the system.

When you launch a program document in some perl, php, or other programming language,

It will actively analyze the environmental variable LANG data,

If it is found that the character encoding cannot be resolved, garbled characters or errors may occur.

General Chinese encoding is usually zh_CN. UTF-8 (Simplified Chinese) or zh_TW. UTF-8 (Traditional Chinese), English character set encoding

The code is usually en_US/en_US.UTF8

Most Linux distributions support Universal Coding (UTF-8) and most languages.

Words.

This is primarily an i18n file.

You can use locale -a to see how many languages linux supports.

You can use the locale command to view the locale of the current system.

[root@nis1 ~]# locale

LANG=zh_CN. UTF-8 ##Main locale

LC_CTYPE="zh_CN. UTF-8" ##Code for character (text) recognition

LC_NUMERIC="zh_CN. UTF-8" ##Display information for numeric systems

LC_TIME="zh_CN. UTF-8" ##Display data for time system

LC_COLATE ="zh_CN. UTF-8" ##String comparison and sorting, etc.

LC_MONETARY="zh_CN. UTF-8" ##Currency Format Display

LC_MESSAGES="zh_CN. UTF-8" ##Information displayed such as menus, error messages, etc.

LC_ALL= ##Overall locale

In general, you can set LANG and LC_AL, and other variables will change accordingly.

You can temporarily adjust the system character set to English using the following command:

export LC_ALL=en_US-UTF-8

2. Set several files related to language:

The/usr/lib/locale/: directory holds language files listed in locale.

/etc/sysconfig/i18n: is the file that sets the system character set.

Whether you install the Chinese version or the English version. Delete the original settings and copy the following.

You can set the language of the system to GB18030 character set in simplified Chinese.

vi /etc/syscnfig/i18n

LANG="zh_CN.GB18030"

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

SYSFONT="latarcyrheb-sun16"

Note:

The first line sets the current system locale

The second line indicates which languages are supported by default. Languages that are not in the project cannot be displayed normally.

The third line defines the console terminal font. The font displayed when logging in is latarcyrheb-

sun16

I18N is an abbreviation for international, meaning there are 18 letters between i and n.

I18N supports multiple languages, but only English and one selected language at a time, e.g. English + Chinese

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