- Fix BOM Office

This commit is contained in:
Vincent BRIDIER 2020-03-09 10:07:01 +01:00
parent 7166ce82f4
commit 069c080b43

View file

@ -149,6 +149,7 @@ class EleveurController extends Controller
public function export(){
$headers = array(
"Content-Encoding" => "UTF-8",
"Content-type" => "Content-type: text/csv; charset=UTF-8",
"Content-Disposition" => "attachment; filename=file.csv",
"Pragma" => "no-cache",
@ -162,6 +163,7 @@ class EleveurController extends Controller
$callback = function() use ($eleveurs, $columns)
{
$file = fopen('php://output', 'w');
fputs($file, "\xEF\xBB\xBF"); // use BOM for Office
fputcsv($file, $columns, ";");
foreach($eleveurs as $eleveur) {