Linux will be Chinese file name file cp to the windows directory after the file name garbled problem solving

  
                  

In Linux, my LC_ALL environment is zh_CN.gbk.

When I put the Chinese file name file into the fat32 disk of Windows, I found that the file name was garbled after I went back to Windows.


First of all, google, baidu, found that convmv is recommended, this tool is written in perl, really very useful tool, but it is not suitable for me here.


---------------------------------- I am gorgeous Split line ---------------------------------


Still take concrete Examples to talk, such as documents, politics. txt, first talk about the root cause of garbled, after viewing with winhex under windows, found that

those file names are indeed gbk encoding, but the encoding gives Separated.


Politics, gbk code D5FE D6CE, but when it is stored on the hard disk, it becomes D500 FE00 D600 CE00. Even if there are no more 00, I can't change the manual

to D5FE D6CE, because Windows uses unicode encoding.


---------------------------------- I am gorgeous Split line ---------------------------------

Try to use convmv to put gbk in linux Turn into unicode to see, but before, use hexedit to see.


Cannot be converted to unicode, ucs-2le or utf-16le, because linux does not support, this encoded file name...

It turns out that hexedit can't see File name, it just looks at the content.


---------------------------------- I am gorgeous Split line ---------------------------------

Write a file from linux and then under ntfs Look at the name, is it also garbled.


This discovery is not garbled and uses this method to successfully solve the problem.


Solution: Put garbled files and folders under linux, from fat32, cp to /root, then mv to ntfs, ok~.

---------------------------------- I am a gorgeous dividing line ---- -----------------------------

Summary of the problem:


I spent a lot of time, 10 hours, how to restore Chinese on fat32, in addition to manual modification,

How to use convmv under Linux. Because linux built-in support utf-8, but does not support utf-16.

So when the last rename operation is performed, the file name of utf-16 cannot be recognized and an error is reported.


However, because of this problem, I have a better understanding of the various ways and differences of coding, as well as transformation methods~


---------------------------------- I am a gorgeous dividing line ------- --------------------------

Cause analysis:

When mounting my fat32 disk, Mount set the encoding method to gbk. ntfs did not find any settings,

Is this the reason? Then enter the Linux study.

Copyright © Windows knowledge All Rights Reserved