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
.
精彩评论