Home >Operation and Maintenance >CentOS >What to do if the Chinese characters in centos7 terminal are garbled
The solution to Chinese garbled characters in centos7 terminal: 1. Check the server encoding; 2. Check the terminal xshell encoding; 3. Set "export LANG="zh_CN.UTF-8""; 4. Restart the server.
#The operating environment of this article: centos7 system, Dell G3 computer.
What should I do if the Chinese characters in the centos7 terminal are garbled?
centos7 terminal displays garbled Chinese characters, and the command returns Chinese garbled characters
1. Check the server encoding command
1.1
echo $LANG
1.2
locale
1.3 Check the terminal xshell encoding
If the above The three points are still consistent, but the code is still garbled. See 2
2. Edit the file
2.1
vi /etc/sysconfig/i18n
Paste the following text
LANG="zh_CN.UTF-8"
2.2
vi /etc/profile
Paste the following text
export LANG="zh_CN.UTF-8"
3. Finally restart the server
Check and you can see that the Chinese file name is displayed normally
Commands and naming returns are also in Chinese!
The same text content is also in Chinese
Recommended tutorial: "centos tutorial"
The above is the detailed content of What to do if the Chinese characters in centos7 terminal are garbled. For more information, please follow other related articles on the PHP Chinese website!