About ultraedit and UTF-8

Source: Internet
Author: User
Tags ultraedit

When I wrote code yesterday, I needed to introduce other files into a template and display them on the page. However, the displayed results were unexpected. An inexplicable character was added, leading to a line break, it's really ugly. This problem was also encountered before. At that time, a header file was included. At the beginning, the cache was deleted using ob_clean. However, the cache cannot be deleted in this task (the introduced page is displayed in the middle ). No way. Run to phpe.net for help (jingdizhiwa is me ). As follows:

Author  Ask include file for inexplicable Character Problems


Jingdizhiwa

Formal Member

GROUP:Ordinary Member
Post:10
Points:0

Posted:2006/03/29 20:22

My current environment is Windows + appserv2.5.5. Because we need to introduce a written module (in HTML format), we need to use the include statement.
However, if a line is left blank, the page is not beautiful. Copy the source code and put it in ultraedit. Why is one more?
No solution was found when I searched for the keyword "php Include problem" in Google. I don't know if anyone encountered this problem and how to solve it. You can also give a link.
Hiaha, 3xs


Adang

Formal Member

GROUP:Ordinary Member
Post:131
Points:1

Posted:

Is the source file in UTF-8 format with Bom?

Adang @ bbs.freecity.cn since 2001


Jingdizhiwa

Formal Member

GROUP:Ordinary Member
Post:10
Points:0

Posted:

Solved
First, according to the adang prompt, I suspect that there is a problem when ultraedit is saved. Therefore, I used Zend studio to view the Referenced File and found that there was a character in front of it. After deletion, the problem was solved.
Then take a closer look at the configuration of ultreedit, close the option "Write UTF-8 header tag (BOM) for all UTF-8 while saving", restart ultraedit, it is found that an inexplicable character is added to the front of the file that is correctly displayed. The hexadecimal format is ef bb bf, which is definitely the problem.

It seems that you should be careful when using ultraedit later.

The problem is now solved. Thanks to adang. In addition, I searched for the "Bom UTF-8" on Google, and found an article based on the standards of the UTF-8 solution plus BOM can be added (information can be stored on www.unicode.org ), because the program can generally be based on the content of the article to determine whether the UTF-8, but with ultraedit as an example, sometimes UTF-8 short sentences will be recognized as ANSI linear regression. Bom is the practice of warranty, and the MS statement, ie and word when the file into the UTF-8 format are added to the BOM, make it easy to identify and confirm when the program is opened.

The BOM for the UTF-8 is efbbbf, because the ultraedit handler will perform Unicode-Le after the UTF-8 file is imported (So what you see in hex mode is not the original word of the UTF-8 file ), when the efbbbf is converted to Unicode-Le, It is fffe (BOM of Unicode-Le). ultraedit cannot identify whether this Bom is reasonable and adds another Bom, so two fffe exist.

Therefore, the best way is
Write UTF-8 BOM header to all UTF-8 files when saved
If it is set to off, the BOM will not be added to the stored file again.

There are several articles about UTF-8 encoding, the original is too long, the following links and keywords are given for query
Http://fmddlmyy.home4u.china.com/text6.html (key: To Talk About unicode encoding, a brief explanation of the UCs, UTF, BMP, BOM and other terms)
Http://wiki.mambochina.net/index.php/UTF-8%E5%AD%97%E7%AC%A6%E9%9B%86%E5%9F%BA%E7%A1%80 (key: UTF-8 Character Set basics)
Http://www.codeguru.com/Cpp/misc/misc/multi-lingualsupport/article.php/c10451/ (key: the basics of UTF-8)

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.