1// --- 3 rows for encoding utf-8
2header('Content-Encoding: UTF-8'); // vilh, change to UTF-8!
3header("Content-type: application/x-msexcel; charset=utf-8"); // vilh, chang
4fputs ($fp, "\xEF\xBB\xBF"); // vilh, change to UTF-8!
5
6// -------------------
7header('Content-Encoding: UTF-8'); // vilh, change to UTF-8!
8header("Content-type: application/x-msexcel; charset=utf-8"); // vilh, change to UTF-8!
9header('Content-Disposition: attachment; filename="'.$fileName.'.csv"');
10header('Cache-Control: max-age=0');
11
12// for browser down
13$fp = fopen('php://output', 'a');
14
15fputs ($fp, "\xEF\xBB\xBF"); // vilh, change to UTF-8!
16
17//header
18foreach ($headlist as $key => $value) {
19 $headlist[$key] = $value; // vilh, change to UTF-8
20}
21
22fputcsv($fp, $headlist);