PHP BOM Issues

Source: Internet
Author: User
Recently co-development projects always found that the PHP output is not the same as the code is not the same as the wit I feel that the code has a problem to find all the Utf-8 the last file content is deleted after the discovery of 3 character size with the Vim-b command opened and found that the feeling of the problem is here.

Later found that this is utf-8 inside the BOM, disgusting is the BOM will be with the echo output caused by the wrong.

Attach several commands to find and remove BOM

In Vim:

Java code

#设置UTF-8 encoding

: Set Fileencoding=utf-8

#添加BOM

: Set Bomb

#删除BOM

: Set Nobomb

#查询BOM

: Set bomb?

Grep:

Java code

Find

Grep-i-r-l $ ' \xef\xbb\xbf '/path

Replace

Grep-i-r-l $ ' \xef\xbb\xbf '/path | Xargs sed-i ' s/^\xef\xbb\xbf//g '

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