Skip to content

Commit

Permalink
Merge pull request #25 from FHA-FB5/titus
Browse files Browse the repository at this point in the history
fix charset for export
  • Loading branch information
TitusKirch authored Oct 28, 2021
2 parents 92e9874 + 714d316 commit 6bbb84a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/Http/Controllers/ExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public function createCsv(){
$persons = Person::all();

$headers = array(
'Content-type' => 'text/csv',
'Content-type' => 'text/csv; charset=UTF-8',
'Content-Encoding' => 'UTF-8',
'Content-Disposition' => "attachment; filename=$fileName",
'Pragma' => 'no-cache',
'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0',
Expand All @@ -36,7 +37,7 @@ public function createCsv(){

$callback = function() use($persons, $columns){
$file = fopen('php://output', 'w');
fputcsv($file, $columns);
fputcsv($file, $columns, ';');

foreach ($persons as $person) {
$row['Nachname'] = $person->lastname;
Expand Down

0 comments on commit 6bbb84a

Please sign in to comment.