The default encoding of Linux is "UTF-8" format, which can be viewed by executing the "locale" command in the terminal. The displayed result is ""LANG=en_US.UTF-8". If you want to modify the encoding Format, you can use the vi command to open the i18n file, modify the encoding value of the "LANG" item, and save the configuration.
The operating environment of this tutorial: linux5.9.8 System, Dell G3 computer.
The default encoding for Windows is GBK, and the default encoding for Linux is UTF-8.
In Linux, we can use the locale command to Check the linux system encoding:
The language is en_US (American English), the encoding is UTF-8
locale command is used to set the program to run Locale.
locale Set the naming rule of the locale to Language_area.charset. For example, en_US.utf8 means that the language is English, the region is the United States, and the character set is UTF-8.
Extended knowledge:
The Chinese edited under Windows is displayed as garbled characters under Linux. In order to solve this problem, modify the default encoding of Linux to GBK.
So what? Modify the default encoding of Linux? Here are several methods:
1. Manually modify the /etc/sysconfig/i18n file
vi /etc/sysconfig/i18n
to modify the default
LANG="en_US.UTF-8" LANG="zh_CN.GB18030"
For:
LANG="zh_CN.GBK" SUPPORTED="zh_CN.UTF-8:zh_CN:zh"
2, vi /etc/profile
export LC_ALL="zh_CN.GBK" export LANG="zh_CN.GBK"
Note: These two methods must be saved after modification.
Related recommendations : "Linux Video Tutorial"
The above is the detailed content of What is the default encoding format of linux?. For more information, please follow other related articles on the PHP Chinese website!