Home > Backend Development > PHP Tutorial > Unicode signature issue in PHP_PHP tutorial

Unicode signature issue in PHP_PHP tutorial

WBOY
Release: 2016-07-21 14:53:24
Original
893 people have browsed it

I spent a long time struggling with the weird blank lines of code in WordPress templates.

Because of the drive of Senior Brother Dansion, I started my Dreamweaver journey. However, few people have noticed that when saving using UTF-8 encoding in Dreamweaver, there are two options by default, "Unicode Standardized Form" and "Include Unicode Signature (BOM)", which can also be seen in the page properties:

If the "Include Unicode signature" option is checked, weird page rendering problems will occur.

 What is Unicode Signature (BOM)?

BOM (Byte Order Mark) is a standard mark used to identify encoding in UTF encoding scheme. The 2 to 4 bytes at the beginning of a text file that identify the file as Unicode and also identify the endianness of the following bytes. Since UTF-8 has no byte order, adding a UTF-8 BOM is optional. This is required for UTF-16 and UTF-32.

Due to the existence of this BOM, PHP will mistakenly believe that the text content has been output, thus affecting page rendering. It is said that this problem has been fixed in PHP6.

How to prevent the impact of Unicode signature (BOM) on page rendering?

Taking Dreamweaver as an example, when saving a UTF-8 encoded document, just uncheck the "Include Unicode Signature (BOM)" option.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/371397.htmlTechArticleI spent a long time struggling with the weird blank lines of code in WordPress templates. Because of the drive of senior brother Dansion, I started my Dreamweaver journey. However, few people pay attention to the use of utf-8 editing in Dreamweaver...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template