Character Encoding issue with PHP Simple HTML DOM Parser

前端 未结 3 1462
被撕碎了的回忆
被撕碎了的回忆 2021-01-07 00:14

I am using PHP Simple HTML DOM Parser http://simplehtmldom.sourceforge.net/ to fetch data like Page Title, Meta Description and Meta Tags from other domains and

3条回答
  •  再見小時候
    2021-01-07 00:52

    If I switch browser encoding to UTF-8, it works.

    So you're simply not setting the correct HTTP header to designate your document to be UTF-8 encoded and the browser is interpreting it in some other encoding. Use:

    header('Content-Type: text/html; charset=utf-8');
    

提交回复
热议问题