UTF-8 NO BOM & BOM

Source: Internet
Author: User
Tags ultraedit




When you modify Ecshop, you may experience a problem with the BOM.

After the modifications are saved, the browser may appear:

Warning:cannot Modify header information-headers already sent ...


Bom


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

File using UTF8 encoding, when saving files, pay attention to the problem of the BOM.

Bom.
Quote:utf-8 is a byte-encoded unit with no byte-order problem. UTF-16 is a two-byte coding unit, before interpreting a UTF-16 text, first figure out the byte order of each encoding unit.

The recommended method of marking byte order in the Unicode specification is the BOM. The BOM is not a BOM for "Bill of Material", but "Byte order Mark".


If you choose to use a BOM when the file is saved, headers already sent problems may occur.
Because the WEB server Software may not know the BOM, so the two special bytes of the BOM as word Fu Fa to the browser.

Then call Session_Start () and other functions, there will be headers already sent problems.

So the most fundamental way to solve this problem is to not use a BOM when saving UTF8 encoded files.

Microsoft Notepad (Notepad) Word can only correctly open the UTF8 file containing the BOM, and then ultraedit on the contrary, back to the BOM UTF-8 file mistaken for ASCII encoding.

UTF-8 BOM is "EFBBBF", because the UE loading UTF-8 file will be converted into UTF16, the EFBBBF in Utf16 is Fffe (Unicode-le's BOM), UltraEdit do not know the BOM and add more than one BOM, So there are 2 Fffe. The file was destroyed by it.

In the WIN32 environment, PHP editors recommend using EditPlus, and the rest, such as Notepad2, is OK.

Further reading: http://zhidao.baidu.com/question/15626866.html

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.