Character encoding and conversion tools for files in Gnu Linux

Source: Internet
Author: User

/********************************************************************* * Author  : Samson * Date    : 07/03/2014 * Test platform: *              3.11.0-12-generic #19-Ubuntu *              GNU bash, version 4.2.45 * *******************************************************************/

View the encoding method of the current file in GNU Linux:

You can use vim to open this file and enter

: Set fileencoding: You can view the character encoding format of the current file. The following content is displayed under the vim window:

Fileencoding = UTF-8
The uplink indicates that the character encoding of this file is UTF-8;



How can we convert the character encoding of a file?
You can use the iconv command for processing,
Iconv-Convert encoding of given files from one encoding to another
The format is generally:
Iconv-f utf8-t UTF-16 foo_in.txt> foo_out.txt
This means to convert the utf8 character encoding file to the utf16 character encoding format. You can use the preceding format to view the converted file. The entered character encoding is as follows:

Fileencoding = utf-16le


PS: You can use the iconv -- list command to view the character encoding formats supported by iconv;

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.