In linux, we sometimes open txt files in windows and find Chinese garbled characters in the txt files normally displayed in windows.
The reason for this is that the Chinese compression methods of the two operating systems are different. In windows, the Chinese compression is generally gbk, and in linux, utf8, this causes normal display in windows.
The txt file is in garbled state in linux.
Solution: Use the iconvcommand in linux. if the garbled file name is shujujiegou.txt, enter the following command on the terminal:
[Plain] view plaincopy
- Iconv-fgbk-tutf8shujujiegou.txt> shujujiegou.txt. utf8
Run the ls command to view the result:
[Plain] view plaincopy
- $ Ls
- Shujujiegou.txtshujujiegou.txt. utf8
We found that the shujujiegou.txt. utf8 file was created again. After opening the shujujiegou.txt file, Chinese characters can be displayed normally.