I'm trying to save data to a CSV from source data containing HTML special characters. I've tried every PHP character encoding/decoding trick I could find, nothing seems to work.
Here's a basic example of what I'm attempting without any attempt to handle the special characters. Can anyone show me what I'm doing wrong?
$file = fopen("output.csv", "w");
fwrite($file, '');
$array = array(
'Casa e Decoração,queimadeestoque20,Zanox',
'eFácil, Cupom de até 10% de desconto na eFácil, Asus'
);
foreach ($array as $line) {
$line = explode(',',$line);
fputcsv($file,$line);
}
fclose($file);