Home >Operation and Maintenance >Linux Operation and Maintenance >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
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!