Linux and security practices five--Character set encoding

Source: Internet
Author: User

Linux and security practices five--Character set encoding

One, ASCII code

The hexadecimal value corresponding to the English letter lxq is found in the table:

4c 58 51

Enter the command in the terminal: Vim Test1.txt

Enter the command on the VIM page:%! Xxd

Use command after losing:%! The following results can be seen when Xxd-r is saved:

Exit the vim Editor and enter the command in the terminal:cat test.txt can view content in test.txt

Second, gb2312 code

Find the hexadecimal value corresponding to the Li Sheli in the encoding table:

C0ee d1a9 e7f9

In the vim editing, the terminal encoding method is modified to gb2312, in the terminal options above the end of the modification,:

After modification, use the command locale -a|grep zh_cn to view the currently owned Chinese character set:

Next, change the character set to the default character set, using the cross-platform 16-HexEdit editor.

Enter the command in the terminal:hexedit text2.txt

As you can see, the interface is friendly, but it's edited in bytes. Enter content into which

Ctrl+w Save, Ctrl+x exit

Change the character set to gb2312 again, and use the Cat directive to view the content

Iii.Utf-8

Find the hexadecimal value corresponding to the Li Sheli in the encoding table:

e69d8e E99baa E790a6

Because the virtual machine default character set is Utf-8, we can see the results in the terminal interface without any setup.

Enter the command in the terminal: Vim Text3.txt

Enter the command on the VIM page:%! Xxd

Use command after losing:%! The following results can be seen when Xxd-r is saved:

Exit the vim Editor and enter the command in the terminal:cat test3.txt can view content in text3.txt

Linux and security practices five--Character set encoding

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.