Home >Backend Development >PHP Tutorial >Unicode signature issue in PHP_PHP tutorial
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.