utf8+bom格式儲存php curl亂碼問題

來源:互聯網
上載者:User

今天開發遇到一個php curl取資料亂碼問題

不是gzip也不是編碼設定問題

最後有一同事判斷為utf8+bom儲存資料原因,懶得深入瞭解utf8+bom,僅做記錄

[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

從curl轉hexdump格式後看,正常的utf8是以|...<!DOCTYPE htm|開頭

utf8+bom儲存的檔案curl得出的是


備忘

詳細參考地址:http://huoding.com/2011/05/14/78

最後當然是讓對方技術人員將檔案轉成utf8儲存即解決問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.