Simple html dom character encoding issue

后端 未结 3 1562
灰色年华
灰色年华 2020-12-18 11:07

I am using simple html dom to retrieve content from another website, but the thing is theres a character encoding issue with the stuff retrieved using simple html dom. The c

3条回答
  •  感动是毒
    2020-12-18 11:35

    Try using iconv to convert the charset of the scraped text to the charset you use on your page.

    Signature:

    string iconv ( string $in_charset , string $out_charset , string $str )
    

    Example:

    echo iconv("ISO-8859-1", "UTF-8", $text);
    

提交回复
热议问题