Xshell Connection CentOS 7.2 Display Chinese garbled problem solving method

Source: Internet
Author: User
Tags bz2

Background

Using a USB flash drive to the Windows host, Linux host files or often, but sometimes the file name is in Chinese,

To the Linux machine will be garbled, the choice is also very troublesome, recently just met, write down the solution.

Environment

Linux

cat /etc/redhat-7.2. 1511 (Core) [[email protected]echo  $LANGen _us. UTF-8[[email protected]

Windows Xshell

Problem

TXT file is used xftp directly from Windows dragged over, on the Linux machine display garbled.

[[Email protected] ~]# lltotal801272-RW-------.1Root root996Dec the  the: Aboutanaconda-KS.CFGDRWXR-xr-x.6Root root -Dec +  -: -cmake-3.7.1-linux-x86_64-rw-r--r--.1Root root30679418Dec +  -: -cmake-3.7.1-linux-x86_64.Tar. GZDRWXR-xr-x.4Root root inDec +  .: thellvm-src-rw-r--r--.1Root root779956643Jan1  -: +Llvm-src.Tar. GZDRWXR-xr-x.8  +  +      4096TheTen   -Vim74-rw-r--r--.1Root root9843297Dec +  to:Genevavim-7.4.Tar. bz2-rw-r--r--.1Root root975JanTen  .: on??????? Regexp.txt[[email protected]-base ~]#

Solve

In general, this problem is the encoding character set of the file, the shell coded character set, the Xshell coded character set mismatch, the matching is possible.

Interim measures

1) Simplified Chinese Windows generally use the GB character set, where Xshell is set to GBK

2)

Linux hosts

[Email protected] ~]# export lang=ZH_CN.GBK

Try again, you can display Chinese normally.

[[Email protected] ~]# ll Total dosage801272-RW-------.1Root root996December the  the: Aboutanaconda-KS.CFGDRWXR-xr-x.6Root root -December +  -: -cmake-3.7.1-linux-x86_64-rw-r--r--.1Root root30679418December +  -: -cmake-3.7.1-linux-x86_64.Tar. GZDRWXR-xr-x.4Root root inDecember +  .: thellvm-src-rw-r--r--.1Root root779956643January1  -: +Llvm-src.Tar. GZDRWXR-xr-x.8  +  +      4096AugustTen  -Vim74-rw-r--r--.1Root root9843297December +  to:Genevavim-7.4.Tar. bz2-rw-r--r--. 1 root root 975 January  : regexp.txt practice 

However, the above settings are only valid for the current shell connection, and the newly opened shell is still in the original settings.

Permanent effect

1) Xshell Property settings

2) Linux environment variable settings

[Email protected] ~]# Vim/etc/profile

Append at end

Export LANG=ZH_CN.GBK

You can do it.

However...... I found that the USB stick inserted on the Linux machine still does not correctly recognize the Chinese directory, the Chinese file

There are other strange, that is, when mounting a USB stick set the next character sets

Mount -o iocharset=gbk/dev/sdb4/mnt

This setting is generally almost solved.

However, this operation caused the import of Xxx.sql file when the database Chinese garbled problem, pending research ...

Xshell Connection CentOS 7.2 Display Chinese garbled problem solving method

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.