Vim display hexadecimal Error

Source: Internet
Author: User
Open the JPG file with vim in Linux and use %! When xxd is displayed in hexadecimal notation, the file header is displayed as "3f3f
3f3f 0011 0804 "The end of the file is" 3f3f"
In Windows, the same operation is displayed as "ffd8 ffc0 0011 0804" and "ffd9 ".
0a ", this is the correct JPEG file header and file tail mark.
Strange!
At the beginning, I thought that JPEG is a different file header in Windows and Linux. Later I removed the JPG suffix, which is a pure file. It may not be a difference in the operating system.
Use ghex again to open the JPEG data and check whether it is displayed normally. The value is "ffd8 ffc0 0011 ".
0804 "and" ffd9 0a ", correct.
It is probably a problem with vim.
What is the 3f ASCII code ?, It indicates that Vim does not parse the file header and tail properly. Is it related to the encoding format used by VIM to parse the file?
Open the. vimrc configuration item and block the following sentence:
Set fileencodings = UTF-8, gb2312, GBK, gb18030, ucs-bom
Use Vim to open the JPEG file and display "ffd8 ffc0 0011 0804" and "ffd9 0a ",
Displayed correctly.
Originally, in order to support recognition and display of Chinese characters, I defined the fileencodings of vim,
When Vim opens a file, it will use the specified encoding format to parse the data. Unfortunately, the JPEG file header ffd8 and the last ffd9
Not any Chinese encoding. If Vim cannot find the corresponding Chinese text, it is displayed ??, That is, 3f3f.
So far, all puzzles are opened.
Related Article

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.