UTF-8 BOM effect on PHP _php tutorial

Source: Internet
Author: User
Today, when you write code with notepad++, a frameset frame template is loaded on the page, and the page is not displayed until the source is checked. And then simply cut out all of the contents of the text can be written in a few tests to display the normal.

Toss for a long time, and finally saw the two control template PHP file is not the same one is UTF-8 no BOM encoding another is the UTF-8 format encoding, try to change that UTF-8 format to UTF-8 no BOM format. Then save, open Firefox, not shown before the frameset template actually shows up. Then again in chrome under the test or not to display, and then think of the other PHP file format is not converted to no BOM format. Check the next all the UTF-8 are changed to UTF-8 no BOM format saved Chrome can also be displayed normally. Finally a sigh of relief.

have been to UTF-8 and UTF-8 No BOM This format does not care too much. So Baidu looked down on their exactly what the difference. Roughly as follows:

UTF-8 encoded files can be divided into no BOM and BOM two formats.

What is a BOM? The three-byte "EF BB BF" is called the full name of Bom,bom called "Byte Order Mard". In the Utf-8 file commonly used BOM to indicate that this file is a UTF-8 file, and the original meaning of the BOM is utf16 used to denote high and low byte sequence. Before the byte stream there is a BOM representation of a low byte sequence (low byte in front), and the UTF8 does not consider the sequence of bytes, so there is no BOM can be. UTF-8 is a byte-coded unit with no byte order problem. UTF-16 takes two bytes as the encoding unit, before interpreting a UTF-16 text, it is first to clarify the byte order of each coding unit. For example, the Unicode encoding for receiving a "Kui" is 594E, and the Unicode encoding for "B" is 4E59. If we receive the UTF-16 byte stream "594E", then is this "Kui" or "B"?

If you choose to use the BOM when the file is saved, the page is not displayed correctly. In General, PHP is not supported with BOM, PHP files should be saved as UTF-8 no BOM type

Therefore, do not use the BOM when saving UTF8 encoded PHP files.

http://www.bkjia.com/PHPjc/819539.html www.bkjia.com true http://www.bkjia.com/PHPjc/819539.html techarticle today, when you write code with notepad++, a frameset frame template is loaded on the page, and the page is not displayed until the source is checked. And then simply delete everything in it and write it all ...

  • 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.