PHP Curl UTF-8 Charset

后端 未结 6 1862
囚心锁ツ
囚心锁ツ 2020-12-05 06:54

I have an php script which calls another web page and writes all the html of the page and everything goes ok however there is a charset problem. My php file encoding is utf-

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-05 07:53

    I was fetching a windows-1252 encoded file via cURL and the mb_detect_encoding(curl_exec($ch)); returned UTF-8. Tried utf8_encode(curl_exec($ch)); and the characters were correct.

提交回复
热议问题