Home > Operation and Maintenance > Linux Operation and Maintenance > Solution to garbled characters in Linux terminal

Solution to garbled characters in Linux terminal

Release: 2019-12-25 11:11:58
Original
2793 people have browsed it

Solution to garbled characters in Linux terminal

Terminal tools generally use the default utf-8 encoding format. If the terminal setting utf-8 is still garbled, the problem is that there is a problem with the Linux encoding format.

Set Linux encoding format

Add the following code in .vimrc (create a new one if there is no .vimrc)

vim ~/.vimrc
Copy after login
set encoding=utf-8 fileencodings=ucs-bom,utf-8,cp936
Copy after login

(1) Execute the locale command to view the system language

# locale
LANG=C
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=
Copy after login

(2) Set the system environment variable LANG to en_US.UTF-8:

export.UTF-8
Copy after login

Or edit the file: vim /etc/sysconfig/i18n

Recommended related article tutorials: linuxtutorial

The above is the detailed content of Solution to garbled characters in Linux terminal. For more information, please follow other related articles on the PHP Chinese website!

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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template