PHP webpage UTF8 coding blank during development

Source: Internet
Author: User
Tags ultraedit
PHP webpage UTF8 encoding is blank during development. Read the blank issue in PHP webpage UTF8 encoding development. a problem that cannot be solved during development the page uses UTF8 encoding, the header and tail use the template file inclusion method. as a result, each header and tail have an extra 10 px blank line, and there is nothing. The reason is that all files are UTF-8 encoded, including "> <LINKhref =" http: // www

A problem that cannot be solved during development
The page is UTF-8 encoded, and the template containing files is used in the header and tail. as a result, each header and tail have a blank line of about 10 PX, and there is nothing.
The reason is that all files are UTF-8 encoded. when files are included, the final binary stream contains multiple utf8 BOM tags. IE cannot parse pages containing multiple UTF8 BOM tags normally, directly replace it with the actual displayed carriage return, which leads to a blank line, but firefox does not.
Therefore, if the template contains multiple utf8 files, use the ultraedit save as function to select utf8 without bom format.
In addition, if the Chinese page places the title tag in the html head tag The page is blank.
Therefore, standard order should be used for utf8 pages










BOM header: \ xEF \ xBB \ xBF, PHP4, and 5 are still ignored. Therefore, the BOM is output directly before resolution.
This w3.org standard FAQ provides a special description of this issue:

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

The details are as follows:

There is a character named "zero width no-break space" in the UCS encoding, and its encoding is FEFF. FFFE does not exist in the UCS, so it should not appear in actual transmission. We recommend that you first transmit the character "zero width no-break space" before transmitting the byte stream ". In this way, if the receiver receives FEFF, it indicates that the byte stream is Big-Endian; if it receives FFFE, it indicates that the byte stream is Little-Endian. Therefore, the character "zero width no-break space" is also called BOM.

The UTF-8 does not need BOM to indicate the byte order, but BOM can be used to indicate the encoding method. The UTF-8 code for the character "zero width no-break space" is ef bb bf. So if the receiver receives a byte stream starting with ef bb bf, it will know that this is UTF-8 encoding.

Windows is the operating system that uses BOM to mark the encoding method of text files: WindowsXP Professional, default character set: Chinese

1) notepad: it can automatically identify UTF-8 encoded files without bom, but it cannot control whether to add bom when saving the file. if the file is saved, the bom will be added in a unified manner.

2) editplus: can not automatically identify the UTF-8 encoding format file without bom, when saving the file, select the UTF-8 format, will not write BOM header in the file header.

3) UltraEdit: it is the most powerful character encoding function. it can automatically identify the UTF-8 files with and without bom (which can be configured). During saving, you can select whether to add bom through configuration.

(Note that when saving a new file, you must save it as UTF-8 no bom)

Later, we found that Notepad ++ also provides better support for the UTF-8 bom. we recommend that you use it.

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.