I have the following code that creates a csv file:
$data=array();
array_push($data,"Société"); //word with french accent
header('Content-Type:text/csv; charset=UTF-8');
header('Content-Disposition: attachment; filename="test.csv"');
$fp = fopen('php://output', 'w');
foreach ( $data as $line ) {
$val = explode(",", $line);
fputcsv($fp, array_map('utf8_decode',array_values($val)), ',', '"');
}
fclose($fp);
However when I open the csv file, the character é is replaced by a question mark ?.
Any help how to resolve this?