Learn to use the character set encoding of tool conversion files in Linux systems

  
                

When you view windows files under Linux, there are often garbled or unreadable situations. This involves the problem of encoding the file character set. You can view the file character set and convert it under Linux. Windows files, let's get to know it.

There are some sites courseware resources are spread Linux server from the windows, the windows folder encoding is GBK, and the browser default encoding scheme is UTF-8 (also server default encoding is UTF -8), this led to the inaccessibility of a domain name like http://xxxx//Resources/Beijing Normal University/Junior High School/Eight Year/This book/Green.ppt, suggesting that resources could not be found.

Solution: Use convmv tool to re-encode the names of all files in the Resources directory using utf-8

Note: If you use ftp client to access resources, you will encounter garbled characters. Please verify that the client encoding is consistent with the server

make clean

make install

. /convmv -f GB2312 -t UTF-8 -r --notest /Resources/*

The above describes how to modify the directory name encoding under linux, and then expand the file content change encoding method

1. Convert file encoding directly in Vim, such as converting a file to utf-8 format

:set fileencoding=utf-8

2. iconv conversion, iconv The command format is as follows:

iconv -f encoding -t encoding inputfile

For example, converting a UTF-8 encoded file to GBK encoding

iconv -f GBK -t UTF -8 file1 -o file2

The above is the method of encoding and converting the file character set under Linux. After converting the character set, the file will not be garbled when viewed on different systems. You have learned ?

Copyright © Windows knowledge All Rights Reserved