Linux File Name Encoding

Source: Internet
Author: User
Linux File Name encoding conversion-general Linux technology-Linux technology and application information. For more information, see the following section. When copying files from Linux to windows or from windows to Linux, Chinese file names may be garbled. This problem occurs because the Chinese encoding of windows file names is GBK by default, in Linux, the default file name encoding is UTF8. Because the encoding is inconsistent, the file name is garbled. To solve this problem, you need to transcode the file name.

In Linux, the tool convmv is designed to convert file names from GBK to UTF-8 encoding or from UTF-8 to GBK.

First, check whether convmv is installed on your system. If not, use:

Yum-y install convmv
Install.

The following describes how to use convmv:

Convmv-f Source Code-t new encoding [Option] File Name

Common parameters:
-R recursive processing of subfolders
-- Notest: the actual operation is not performed by default, but is only a test.
-- List displays all supported codes
-- Unescap can be used as an escape, for example, % 20 is converted into a space.

For example, we have a UTF-8 encoded file name and convert it to GBK encoding. The command is as follows:

Convmv-f UTF-8-t GBK -- notest utf8 encoded file name

After the conversion, "utf8 encoded file name" will be converted to GBK encoding (only the conversion of file name encoding, the file content will not change ).

Note: Do not use this command in the NTFS and FAT file systems. Otherwise, unexpected results may occur. If you want to correctly display the NTFS and FAT file names in Linux, you can solve this problem by using the mount parameter. For details, refer to the man manual.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.