1.utf-8 BOM can cause CSS style confusion:
Utf-8 is an encoding of Unicode characters that are often used in Web applications, and the advantage of using utf-8 is that it is a variable-length encoding, with a length of 1 bytes for ansii encoding, so that when a page with a large number of ASCII character sets is transmitted, Network bandwidth can be massively saved.
When you use UTF-8 encoding to write a Web page, it often occurs because of a problem with the BOM (Byte Order Mark), which often causes unknown empty lines or garbled characters in the page. This is because the UTF-8 encoding is not mandatory for the BOM. Therefore, the UTF-8 encoding when saving the file, there will be different processing methods. For example, some browsers (FireFox) can automatically filter out all the Utf-8 BOM, some (IE) can only filter out a BOM (why once?) This is the problem you'll encounter when you appear in the Include multiple files).
use EditPlus or other editor to delete the BOM signature in the file, re-refresh the page, the style is normal.
here to find a description of the BOM, may help you understand:
In the UCS encoding is called" ZERO WIDTH no-break SPACE "character, and its encoding is Feff. Fffe is not a character in UCS, so it should not appear in the actual transmission. The UCS specification recommends that the character "ZERO WIDTH no-break SPACE" be transmitted before the byte stream is transmitted. This means that if the recipient receives Feff, the byte stream is Big-endian, and if Fffe is received, it indicates that the byte stream is Little-endian. So the character "ZERO WIDTH no-break SPACE" is also called a BOM. The
UTF-8 does not require a BOM to indicate the byte order, but can be used to indicate the encoding using a BOM. The UTF-8 code for the character "ZERO WIDTH no-break SPACE" is the EF BB BF. So if the receiver receives a byte stream beginning with the EF BB BF, it knows that this is UTF-8 encoded.
Windows uses a BOM to mark the way a text file is encoded.
utf-8 encoded file, the BOM occupies three bytes. If you use Notepad to save a text file as UTF-8 encoding, open the file with your UE, switch to the hexadecimal edit State to see the beginning of the Fffe. This is a good way to identify the UTF-8 encoded file, the software through the BOM to identify whether this file is UTF-8 encoding, many software also requires that the file read must have a BOM. However, there are still many software that do not recognize the BOM. When I was studying Firefox, I knew that in the early versions of Firefox, there was no BOM in the extension, but the version of Firefox after 1.5 has started to support the BOM. It is now also found that PHP does not support the BOM.
PHP does not consider BOM at design time, that is to say, he will not ignore the UTF-8 encoded file at the beginning of the BOM three characters. Since the code that must be in the <? or <?php will be executed as PHP code, the three characters will be output directly. If the plug-in file has this problem, will cause in the background page activates or does not activate the plugin after the display white screen, if the template file has this problem, will cause the three characters directly output, resulting in a small blank line above the page. Foreign English plug-ins and templates are generally used ASCII code encoding method, there will be no BOM, only the domestic plug-in and template will be due to the author's ignorance caused problems. Also, when you modify the template, because the output page using UTF-8 encoding, then modify the template if you have to add Chinese characters, you must convert the file to UTF-8 encoding to normal display, this time if the editor used automatically added the BOM, will result in the output of these three characters on the page , the display effect depends on the browser, is usually a blank line or a garbled.
--------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------
2. Bulk Delete PHP code BOM header commands:
Locate the file that contains the BOM header, as follows:
Grep-r-i-l $ ' ^\xef\xbb\xbf '.
This command will find all the files containing the BOM header in the current directory and subdirectories, and output the file name on the screen.
However, the deletion of the BOM header, the Web-found commands are mostly not available, the more common commands are:
Grep-r-i-l $ ' ^\xef\xbb\xbf '/path | Xargs sed-i ' s/^\xef\xbb\xbf//;q '
But this command removes all rows except the first line, so it makes no sense.
It is possible to test the following commands:
Find. -type f-exec sed-i ' s/\xef\xbb\xbf//' {} \;
This command removes the BOM header from the current directory and all subdirectories.
--------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------
3. References:
explain BOM header and remove BOM header method:http://my.oschina.net/xianggao/blog/79694php Removal BOM header : http://www.oschina.net/code/snippet_162279_10073PHP UTF8 file format causes CSS style dislocation:Http://blog.csdn.net/aniven/article/details/6925561?reloadThe same code, why does the browser press F12 after seeing the code there is such a gap:http://bbs.csdn.net/topics/390821227?
File encoding and UTF-8, BOM, 0XFEFF related issues:
Http://www.169it.com/article/11324591921744705430.html
linux find the file that contains the UTF8 BOM header and delete the BOM header information (Feef) :
&NBSP; http://digdeeply.org/archives/02072438.html
linux Find the file that contains the BOM header and clear the BOM header command:
http://blog.sina.com.cn/s/blog_49f914ab0101eyjj.html
PHP Project deployed in the CentOS system, resulting in page layout confusion, click button and link unresponsive solution (go to BOM header)