开发者

Greek characters problem in fgetcsv?

When i split a csv file with my php script i can not see the greek languag开发者_开发技巧e characters! Could you please help me to convert them? data will be saved in the csv.

<?
$path="book.csv";
if (($handle = fopen("$path", "r")) !== FALSE) {
    while (($info = fgetcsv($handle, 1000, ",")) !== FALSE) {
    print_r($info);
    echo "<br>";
  }
}
?>

DEMO

the question mark is actually the greek words. please help me thank you


You need to send the correct charset in the content-type HTTP header - which is the same charset the CSV has been saved with. You can also convert the csv data from the original encoding to UTF-8 using mb_convert_string or iconv.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜