How to solve the garbled characters of Chinese file names under linux command line

Source: Internet
Author: User
Tags i18n

How to solve the garbled characters of Chinese file names under linux command line

First, query the supported encodings:

Locale-a

If you don't have the code you need, such as Zh_cn.utf8

Root run: #dpkg-reconfigure locales

Select the encoding you want, select it with a space, and choose multiple options. tab select "OK" and enter.

Default encoding Selection Zh_cn.utf8

Install the encoding you need.

Method One:

Modify the/etc/sysconfig/i18n file

Change the lang= "en_US" inside to GB2312.

To restart the machine.

Without restarting the method, directly

# lang= "GB2312"

And then we can.

Modify i18n just to restart the active


Method Two:

#vi ~/.bash_profile

Lang=zh_cn. GB18030

Language=zh_cn.gb18030:zh_cn.gb2312:zh_cn

Export LANG LANGUAGE

This will be able to input and display the Chinese in the terminal, and the shell script in the original Chinese display garbled problem also solved


Method Three:

Modify/etc/sysconfig/i18n

The 1th sentence lang= "ZH_CN. UTF-8 "changed to Lang=" ZH_CN. GB18030 "


Method Four:

Modify/etc/sysconfig/i18n

Language= "Zh_CN.GB18030:zh_CN.GB2312:zh_CN"

Supported= "ZH_CN. GB18030:zh_CN:zh:en_US. Utf-8:en_us:en "

Sysfont= "Lat0-sun16"

Sysfontacm= "8859-15"


Method Five:

cd/etc/sysconfig/

CP i18n I18n.bak #备份i18n文件

echo "" >i18n

VI i18n #加入以下内容

Lang= "ZH_CN. GB18030 "

Language= "Zh_CN.GB18030:zh_CN.GB2312:zh_CN"

Supported= "ZH_CN. GB18030:zh_CN:zh:en_US. Utf-8:en_us:en "

Sysfont= "Lat0-sun16"

Chinese display is normal after reconnecting

Method Six:

Modify/etc/profile,

Comment out

Export Lc_all=c

Increase

Export Term=xterm-color

Export lc_ctype=zh_cn.gb2312

Export Lang=en_us. UTF-8


How to solve the garbled characters of Chinese file names under linux command line

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.