Recently put the project on GitHub, but found the code in the Chinese part of the comments are garbled, after the check found that because my CentOS installed on the virtual machine, and I am in the Windows environment through the UE to write code, and UE by default, using ASCII encoding.
So you want to use commands on Linux to convert the encoding format in bulk.
After checking the data, we found that the iconv command can be used.
First, use the file command to detect the type of files
Example:filetest.cpp
Output:ISO-8859 Cprogram text
Parameter description of the iconv command:
- l List all known character sets
- F Raw Text encoding
- t output text encoding
- o output file name
- s off warning
Example:
iconv-f gb2312-t UTF-8 test.cpp > Test_utf.cpp
Because Iconv is output to standard output by default, we need to redirect to a different file. (This cannot be redirected to itself, otherwise the contents of the file will be emptied)
If you want to output the output directly to the current file, you can use the following:
iconv-f gb2312-t UTF-8-o test.cpp test.cpp
File encoding format conversion under Linux