Linux coding conversion basic tutorial

  

View the file encoding under the Linux command line

enca file name

linux file name encoding batch conversion

convmv -f source Encoding -t New encoding [options] File name

Common parameters:

-r Recursive processing subfolders

-notest Real operation, please note that by default It is not a real operation of the document, but an experiment.

-list Show all supported encodings

-unescap Can do escaping, such as turning %20 into a space

For example, we have a utf8 encoded filename. Convert to GBK encoding, the command is as follows:

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

Linux batch conversion file content encoding

1. Use enca, for example, to convert all files in the current directory to utf-8

$enca -x utf-8 *

2, use iconv to convert

iconv command 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

Copyright © Windows knowledge All Rights Reserved