Linux file encoding and conversion

Source: Internet
Author: User

0. view the file encoding. UseFileCommand

[Root @ gm15vm02-hvm xenoprof] # file xenoprofile.install.txt

Xenoprofile.install.txt:ISO-8859Text

Lang = zh_cn.gb18030 when writing the file, encoding should be gb18030, here shows the ISO-8859, it should be because of the compatibility relationship.

I. ExploitationIconvCommand to encode and convert the File Content

The iconv command is used to convert the encoding of a specified file. By default, it is output to a standard output device, or an output file.

Usage: iconv [option...] [file...]

The following options are available:

Input/output format specifications:

-F, -- from-code = Name Original Text Encoding

-T, -- to-code = Name output Encoding

Information:

-L, -- list lists all known character sets, not all of which can be used for-F,-T options

Output Control:

-C: Ignore invalid characters from the output

-O, -- output = file: output file

-S, -- silent close warning

-- Verbose prints the progress information

-?, -- Help: Provides the system's help list

-- Usage provides brief usage information

-V, -- version print the program version number

Example:

Iconv-F gb18030-T UTF-8 xenoprofile.install.txt> a.txt

This command reads the xenoprofile.install.txt file, converts from gb18030 encoding to UTF-8 encoding, and its output is directed to the.txt file.

Refer:

Http://www.examw.com/Linux/all/104572/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.