Home  >  Article  >  Operation and Maintenance  >  Linux cannot input Chinese

Linux cannot input Chinese

王林
王林Original
2020-01-11 09:30:125201browse

Linux cannot input Chinese

Environment:

Server environment: Ubuntu Server 16.04 lts

Server encoding configuration:

First, we use a shell connection to log in to the server, and then enter the locale command in the terminal. The results are as follows:

$ locale
LANG=
LANGUAGE=C:
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=

(free video tutorial recommendation: linux video tutorial)

The meaning of each option is as follows:

Language symbols and their classification (LC_CTYPE)

Numbers (LC_NUMERIC)

Comparison and sorting Habit (LC_COLLATE)

Time display format (LC_TIME)

Currency unit (LC_MONETARY)

The information is mainly prompt information, error information, status information, title, label, button and menus, etc. (LC_MESSAGES)

Name writing method (LC_NAME)

Address writing method (LC_ADDRESS)

Telephone number writing method (LC_TELEPHONE)

Weights and measures Expression (LC_MEASUREMENT)

Default paper size (LC_PAPER)

Overview of the information contained in the locale itself (LC_IDENTIFICATION).

What we want to fix is ​​the Chinese input problem, so we only need to set LC_CTYPE next.

Check the encoding method supported by the system:

locale -a

Check whether the output content contains zh_CN.utf-8. If not, you can install the language pack first.

sudo apt-get -y install language-pack-zh-hans

zh_CN.utf-8 has been included after installation

Next, modify the value of LC_CTYPE and use the export LC_CTYPE='zh_CN.UTF-8' command to modify it .

Direct execution export LC_CTYPE='zh_CN.UTF-8'Then it is only valid for the current session

All users (permanent): modify /etc/profile

Current user (permanent): Modify ~/.bashrc

It is recommended to modify the /etc/profile file directly so that all users can use it.

After the modification is completed, log out, log in again, and then enter the locale command, you can get the following output:

LANG=
LANGUAGE=C:
LC_CTYPE=zh_CN.UTF-8
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=

After that, you can enter Chinese:

Linux cannot input Chinese

Recommended related articles and tutorials: linux tutorial

The above is the detailed content of Linux cannot input Chinese. 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