Hi,
I have a string variable:
$billing['street_address'] = "Præstelængen";
It is in UTF-8:
dd(mb_detect_encoding ($billing['street_address']));
// UTF-8
I do the following to make a CSV file:
($billing is now part of $OrderData array)
$fp = fopen($filename, 'w');
foreach ($OrderData as $records) {
fputcsv($fp, $records);
}
fclose($fp);
The string comes out in the csv file as: Pr?stel?ngen
Googling around I saw some point to this:
fputs($fp, $bom =( chr(0xEF) . chr(0xBB) . chr(0xBF) ));
But it didn’t work for me. It gives me ? in diamonds instead.
Any ideas?