PHP Web page UTF8 Coding development Blank Problem _php Tutorial

Source: Internet
Author: User
Tags ultraedit

A problem that has not been solved in the development
The page uses UTF8 encoding, the head and tail of the template contains the method of the file, the result of the head and tail of the end of an empty line of about 10px, nothing.
The reason is that all of the UTF8 encoding, including the file, the final binary stream contains multiple UTF8 BOM tags, ie can not parse the page containing multiple UTF8 BOM, directly replaced with the actual display of the carriage return, which leads to a blank line, and Firefox does not have this problem.
Therefore, if the template is contained in a method containing multiple UTF8 files need to be saved with UltraEdit Save As feature selection UTF8 no BOM format to save.
Also, if the Chinese page places the title tag in the HTML head tag, it will cause the page to be blank.
So the UTF8 page should use the standard order










BOM head: XEFXBBXBF,PHP4, 5 is still ignoring the BOM, so the direct output before parsing.
There is a special description of this issue in this w3.org standard FAQ:

Http://www.w3.org/International/questions/qa-utf8-bom

Specific as follows:

There is a character called "ZERO WIDTH no-break SPACE" in the UCS encoding, 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 byte order, but it 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 is the operating system that uses the BOM to mark the encoding of a text file: windowsxp Professional, default character set: Chinese

1) Notepad: can automatically recognize the UTF-8 encoded format file without BOM, but can not control whether to add BOM when saving the file, if save the file, then the BOM will be added uniformly.

2) EditPlus: Can not automatically identify the Utf-8 encoding format file without BOM, file save, select UTF-8 format, will not be written on the file header BOM header.

3) UltraEdit: For character encoding is the most powerful, can automatically identify with the BOM and without BOM Utf-8 file (can be configured), save the time can be configured to choose whether to add a BOM.

(It is important to note that when you save a newly created file, you need to select Save as Utf-8 no BOM format)

Later found Notepad + + also for Utf-8 BOM support is better, recommend everyone use.

http://www.bkjia.com/PHPjc/486563.html www.bkjia.com true http://www.bkjia.com/PHPjc/486563.html techarticle Development has not been able to solve a problem page using UTF8 encoding, the head and tail with the template contains the method of the file, the result of the head and tail of the end of each of the more than an empty line about 10px .

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