Home > Operation and Maintenance > Linux Operation and Maintenance > What to do if the Chinese file name is garbled under Linux

What to do if the Chinese file name is garbled under Linux

王林
Release: 2020-03-13 14:45:41
Original
5259 people have browsed it

What to do if the Chinese file name is garbled under Linux

Problem:

When using ftp to upload files to Linux on Windows, the Chinese name is displayed as garbled characters in the Linux system. Although the Linux env is set to LANG=en_US.UTF-8, and the local Shell client encoding is also set to UTF-8, it is still garbled in the Shell (or accessed through http).

Reason:

The default Chinese encoding of file names in Windows is GBK. After compression or uploading, the file names will still be GBK encoded, while the default file name encoding in Linux is UTF8 due to inconsistent encoding. This leads to the problem of garbled file names. To solve this problem, the file names need to be transcoded.

(Recommended tutorial: linux tutorial)

Solution:

yum install convmv
Copy after login
convmv -f gbk -t utf-8 -r --notest /home/要操作的文件
Copy after login

Common parameters:

-r Recursively process sub-files Folder

-notest actually performs the operation. By default, no real operation is performed on the file.

-list displays all supported encodings

-unescap. You can do some escaping, such as Turn it into a space

-i Interactive mode (ask every conversion to prevent misoperation)

Recommended related video tutorials: linux video tutorial

The above is the detailed content of What to do if the Chinese file name is garbled under Linux. 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