Copying files from windows to Linux sometimes results in garbled Chinese file names. This problem occurs because the Chinese encoding of Windows file names is GBK by default, in Linux, the default file name encoding is utf8. Due to inconsistent encoding, the file name is garbled. To solve this problem, you need to transcode the file name.
Today, we will introduce a Linux tool: convmv. It can help you complete the conversion of file name encoding, the file name from GBK to UTF-8 encoding, but also from the UTF-8 to GBK.
First, check whether convmv is installed on your system. If it is not installed, use:
Yum-y install convmv installation.
The following describes the usage of convmv:
Convmv-f Source Code-t new encoding [Option] File Name
Common parameters:
-R recursive processing of subfolders
-Notest performs transcoding. Note that by default, the file name is not actually transcoded, but only a test.
-List: displays all supported codes.
-UNESCAP can be used as an escape to convert % 20 to a space.
Now we have a UTF-8 encoded file name, which is converted to GBK encoding. The command is as follows:
Name of the convmv-F UTF-8-t gbk-notest utf8 encoded file
In this way, the "utf8 encoded file name" will be converted to GBK encoding (only the conversion of file name encoding will not change the file content)
The problem of garbled Chinese characters in the Working Copies of Svn in Linux can also be solved. It is a good tool.