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 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: Windows file name Chinese encoding defaults to GBK . After compression or uploading, the file name will still be GBK encoding, and the default file name encoding in Linux is UTF8 . Due to inconsistent encoding, the file name is garbled. Solve this problem The problem requires transcoding the file name.
Install convmv:
sudo apt-get install convmv
use:
convmv -f gbk -t utf-8 -r --notest /home/test
common parameters:
-f
specify the encoding of the current file name, such as: gbk
-t
specifies the encoding to be converted to, such as: utf-8
-r
recursively processes the subfolders to
--notest
actually operate, the default is to only print the converted effect, add this The option is to actually perform the conversion operation.
-i
Interactive mode (ask for each conversion to prevent misuse)
Note:
Do not use this command in the NTFS and FAT file systems, otherwise accidents may occur.