$url ="http://www.amazon.co.jp/dp/B007HDJPOU"; $handle=mb_convert_encoding(file_get_contents($url), 'UTF-8','utf-8, shft-jis, gbk');$sumopen=fopen("001.txt","w");fwrite($sumopen,$handle);fclose($sumopen);
本来就是shift-jis编码,没转换
他有
mb_convert_encoding(file_get_contents($url), 'UTF-8','utf-8, shft-jis, gbk');
是不是写错了?
只能把页面编码改成Shift_JIS??
你写的是什么?
'UTF-8','utf-8, shft-jis, gbk'
xuzuning大大,已经改过来了
输出的文件还是乱码
$handle=mb_convert_encoding(file_get_contents($url), 'UTF-8','utf-8, shft_jis, gbk');$sumopen=fopen("001.txt","w");fwrite($sumopen,$handle);fclose($sumopen);
$handle=mb_convert_encoding(file_get_contents($url), 'UTF-8','utf-8, shift_jis, gbk');
再想了一下,感觉是编码已经转换了
问题应该出在写入文件上,改成这个试试
$sumopen=fopen("001.txt","w b");
就是按字节输出,你打开这个txt要选无bom utf-8打开