Sending a UTF8 encoded CSV from PHP
It is easy to generate a CSV file using the fputcsv function. One of a very common problems is even the file is UTF-8 encoded, Microsoft Excel is still unable to identiy the file as UTF-8.
To solve this, you need to add the UTF-8 BOM to the beginning of the file.
<?php echo "\xEF\xBB\xBF" . $csvdata; // Assume $csvdata contains the CSV string you want to output