ブラウザで xml ページを右クリックして AS を保存し、Notepad++ で開くと、英語以外の文字で問題なく表示されます。ただし、ページをサーバーに保存するスクリプトを作成すると、文字エンコーディングに問題が発生します。これは本当に頭が痛いです。何か助けはありますか?ありがとう。
function download_page($path)
{
//$path = htmlentities($path);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$path);
curl_setopt($ch, CURLOPT_FAILONERROR,1);
//curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 280);
$retValue = curl_exec($ch);
if (!$retValue){ //echo "erro curl";
}
@curl_close($ch);
return $retValue;
}
$file= download_page($url);
$file = mb_convert_encoding($file, 'HTML-ENTITIES', "UTF-8");
$file = utf8_encode ($file);