Solve GBK migration to UTF-8 Chinese name garbled under Linux

        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
-tspecifies the encoding to be converted to, such as: utf-8
-rrecursively processes the subfolders to
--notestactually operate, the default is to only print the converted effect, add this The option is to actually perform the conversion operation.
-iInteractive 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.

Published 32 original articles · won praise 1 · views 4551

Guess you like

Origin blog.csdn.net/hezhanran/article/details/101439036