linux file name garbled

angryTom
Release: 2019-11-05 11:45:56
Original
4500 people have browsed it

linux file name garbled

linux file name is garbled

Use ftp on windows to upload files to Linux, the Chinese name is in the Linux system appears as garbled characters. 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).

The reason is that the default Chinese encoding of file names in Windows is GBK. After compression or uploading, the file name will still be GBK encoded, while the default file name encoding in Linux is UTF8. Due to inconsistent encoding, the file name will be changed. The problem of garbled characters requires transcoding the file name to solve this problem.

yum install convmv 
convmv -f gbk -t utf-8 -r --notest /home/wwwroot
Copy after login

Commonly used parameters:

-r Recursively process subfolders

-notest Really perform operations. By default, no real operations are performed on files

–list displays all supported encodings

-unescap can be escaped, such as changing it to a space

-i Interactive mode (ask for each conversion to prevent misoperation)

There are many convenient gadgets under Linux to convert encodings:

Text content conversion iconv

File name conversion convmv

mp3 tag conversion python-mutagen

Recommendation:Introduction to Linux system learning

The above is the detailed content of linux file name garbled. 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