Originally from: http://www.zhukun.net/archives/7434
Chinese file name garbled in the CentOS system2014/09/01Linux op centos, Linux Bear
Files or directories uploaded from Windows to Linux are displayed as garbled 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, but in the shell (or through HTTP access), is still garbled ...
The reason is that the name of the Windows Chinese encoding default is GBK, compressed or uploaded, the file name will also be GBK encoding, and Linux default file name is encoded as UTF8, because of inconsistent encoding, resulting in file name garbled problem, to solve this problem requires the file name transcoding.
wget http://pkgs.repoforge.org/convmv/convmv-1.15-1.el6.rf.noarch.rpm rpm -ivh convmv-1.15-1.el6.rf.noarch.rpm /usr/bin/convmv -f gbk -t utf-8 -r --notest /home/wwwroot |
Common parameters:
-R recursive processing of subfolders
–notest real operation, by default it does not do real operation of the file
–list display of all supported encodings
–unescap can be escaped, such as to turn%20 into a space
-I interactive mode (asking for each conversion to prevent mis-operation)
There are many handy gadgets to convert your code under Linux:
Text content conversion Iconv
File name Conversion CONVMV
MP3 Label Conversion Python-mutagen
Chinese file name garbled in the CentOS system