In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Unicode signature bom analysis, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
Unicode signature bom- what is bom?
BOM is the abbreviation of Byte Order Mark. It is the standard tag used to identify the code in the UTF coding scheme. It is originally FF FE in UTF-16, but when it becomes UTF-8, it becomes EF BB BF. This flag is optional because UTF8 bytes are out of order, so it can be used to detect whether a byte stream is UTF-8 encoded. Microsoft does this test, but some software does not do this test, but treats it as a normal character.
Microsoft adds three bytes of EF BB BF in front of its own text file in UTF-8 format. Notepad and other programs on windows determine whether a text file is ASCII or UTF-8 based on these three bytes. However, this is only a mark made by Microsoft secretly, and there is no such mark for UTF-8 text files on other platforms.
Unicode signature bom- how to check utf-8, that is to say, an UTF-8 file may or may not have BOM, so how can you tell the difference?
There are four ways.
1. Open the file with UltraEdit-32, switch to hexadecimal editing mode, and see if there is EF BB BF in the header of the file.
2. Open it with Dreamweaver and look at the properties of the page to see if there is a check before "including Unicode signature BOM".
3, open it with Windows's notepad and select "Save as" to see whether the default encoding of the file is UTF-8 or ANSI, and if it is ANSI, there is no BOM.
Unicode signature bom
4: open it with emeditor, select "Save as", and see the
Whether to add unicode signature (bom) (G) is checked. As shown in the figure:
Problems and Solutions of Unicode signature bom- in php
Note that when you use Convertz to convert gb2312 files to UTF-8 files, the default setting is without BOM. The above garbled code problems may occur without BOM, but with BOM, be careful with php include files, there will be more EFBBBF in front of the php byte stream, and early output to the monitor may lead to program errors. One solution is that all files that are include are saved as ANSI, and the master file can be UTF-8. To remove BOM from a file, use UlterEdit to open it, switch to hexadecimal editing mode, replace the first three bytes (the damn EFBBBF) with 20, save (note that automatic backup is turned off when saving), and then switch to the default editing mode, removing the first three spaces.
A little knowledge of Unicode signature bom- coding
In addition, I also learned a little bit about coding: the file saved by the so-called unicode is actually utf-16, but it just happens to be the same as the code of unicode, but conceptually, unicode and utf are two different things. Unicode is the in-memory coding representation scheme, and utf is how to save and transfer unicode. Utf-16 can also be divided into two types: high-order first (LE) and high-order last (BE). The official utf code is also utf-32, which is also divided into LE and BE. The unofficial utf code of unicode is also utf-7, which is mainly used for mail transmission. The single-byte part of utf-8 is compatible with iso-8859-1, mainly because some old systems and library functions can not handle utf-16 correctly, and save file space for English characters (at the expense of non-English characters). In iso-8859-1, both utf8 and iso-8859-1 are represented by one byte, and utf-8 uses two or three bytes when representing other characters.
After reading the above, have you mastered the method of how to analyze the Unicode signature bom? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.