Php curl garbled characters saved in utf8 + bom format

Source: Internet
Author: User

Today, I encountered a php curl data garbled problem.

Neither gzip nor encoding settings

At last, a colleague determined that utf8 + bom was the reason for saving the data. He was too lazy to understand utf8 + bom in depth and only recorded the data.

[root@centos5 ~]# curl -s http:  ef bb bf 3c   4f          6d  ||  6c     4c      2d 2f 2f     |l PUBLIC   2f 2f         4d 4c   2e    |     6e      6f 6e  6c 2f 2f  4e  |Transitional         3a  2f 2f    2e    | http:  2e 6f   2f   2f     6d 6c  2f   |.org/TR/xhtml1/D|    2f    6d 6c   2d    6e    |TD/xhtml1-transi|    6f 6e  6c 2e      3e 0d 0a        |tional.dtd~]# curl -s http:  ef bb bf                                        |...|
~]# curl -s http: ef bb bf 3c 4f 6d || 6c 4c 2d 2f 2f |l PUBLIC 2f 2f 4d 4c 2e | 6e 6f 6e 6c 2f 2f 4e |Transitional 3a 2f 2f 2e | http: 2e 6f 2f 2f 6d 6c 2f |.org/TR/xhtml1/D| 2f 6d 6c 2d 6e |TD/xhtml1-transi| 6f 6e 6c 2e 3e 0d 0a |tional.dtd

After converting the curl to the hexdump format, the normal utf8 format is |... <! DOCTYPE htm | start

Utf8 + bom:

 

Memo

Http://huoding.com/2011/05/14/78:

Finally, ask the other technical staff to convert the file into utf8 and save it to solve the problem.

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.