Home > php教程 > PHP开发 > How to solve Chinese garbled characters in Linux

How to solve Chinese garbled characters in Linux

高洛峰
Release: 2016-12-15 16:43:16
Original
1845 people have browsed it

When you first start using the Linux system, everyone will encounter a problem, that is, when the terminal input command is echoed, the Chinese characters are displayed as garbled characters. Why does such a problem occur? When such a problem occurs, how should we solve it? What's the solution? Today, the editor will tell you about the solution to Chinese garbled characters in Linux.

 The steps are as follows:

 1. How to view and set the system language package in Linux

 1. View the current system language

 After logging in to the Linux system and opening the operating terminal, enter echo $LANG to view the currently used system language. Such as

How to solve Chinese garbled characters in Linux

 2. Check the installed language pack

To see if there is a Chinese language pack, you can enter the locale command in the terminal. If there is zh cn, it means that the Chinese language has been installed

How to solve Chinese garbled characters in Linux

 3. What if there is no Chinese language?

 You can download and install the Chinese language package yum groupinstall chinese-support from the Internet (if you cannot connect to the Internet, download it from other computers, upload it)

How to solve Chinese garbled characters in Linux

 2. How to modify the system language to Chinese

 1. Temporarily change the language

If you only temporarily change the language environment of the Linux system, you can set LANG=language name by inputting it, such as Chinese is

 Zn_CN.UTF-8 (note that this is originally Chinese, I temporarily set it to English

How to solve Chinese garbled characters in Linux

2, Modify the system default language

 The above method is to set the system default language configuration by modifying it

 For example, Vi /etc/sysconfig/i18n (note to restart the system after changing it)

How to solve Chinese garbled characters in Linux

 3. Other precautions

 If you follow If the above method settings and modifications to the Chinese language still don’t work, pay attention to the encoding selected by your link terminal. For example, xshell, select Chinese or UTF8 for the terminal encoding. 4. After setting it up, try again. Check the previous garbled files and you will see that they are displayed in Chinese

How to solve Chinese garbled characters in LinuxThe above is the entire content of the editor’s introduction to the solution to Chinese garbled files in Linux. Such problems are usually caused by the Chinese language package not being installed, or. There is a problem with the default language setting. You can try the above method to solve it!

How to solve Chinese garbled characters in LinuxPlease pay attention to the PHP Chinese website for more related articles on how to solve the Chinese garbled code in Linux!

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template