title: æøå in csv export
body: <p>I'm trying to export some data into an CSV file i can download. </p>
  
  <p>if im hitting my API in postman the data looks fine like:</p>
  
  <pre><code>Notat,Vare,Type,Størrelse,Tekst,Antal,Pris,Rabatprocent,Totalbeløb,Fakturerbar,"Lever nu",Faktureret,Lagersted,Placering,Lagerstyring
  ,,,,"Fadol 0,5 - 6 stk. ",4,,"0,00",1000,Checked,0,"0,00",,,Intet
  ,,,,"Classic 0,5",34,,"0,00",1700,Checked,0,"0,00",,,Intet
  ,,,,"Classic 0,5 - 6 stk ",3,,"0,00",750,Checked,0,"0,00",,,Intet
  ,,,,"Grimbergen 0,3",6,,"0,00",240,Checked,0,"0,00",,,Intet
  ,,,,"Nordic flaske ",0,,"0,00",0,Checked,0,"0,00",,,Intet
  ,,,,Kildevand,109,,"0,00",2160,Checked,0,"0,00",,,Intet
  ,,,,"Smirnoff 6 stk",0,,"0,00",0,Checked,0,"0,00",,,Intet
  ,,,,"Sæson 0,3",2,,"0,00",80,Checked,0,"0,00",,,Intet
  ,,,,"Sodavand 0,3",5,,"0,00",150,Checked,0,"0,00",,,Intet
  ,,,,"Sodavand 0,5",102,,"0,00",4040,Checked,0,"0,00",,,Intet
  ,,,,"Fadøl 0,5",20,,"0,00",1000,Checked,0,"0,00",,,Intet
  ,,,,"Kop varme drikke",17,,"0,00",255,Checked,0,"0,00",,,Intet
  </code></pre>
  
  <p>But when i open the CSV file after downloading it will show Størrelse as StÃ¸rrelse. Så it works fine in postman but not in the actual CSV file. someone can point me in the right direction for where my problem is?</p>
  
  <p>Here is my code that creates the export:</p>
  
  <pre><code>//Open file pointer.        
          $fp = fopen('php://output', 'w');
  
          //Loop through the associative array.
          foreach($sortedData as $row){
              //Write the row to the CSV file.
  
              fputcsv($fp, $row);
          }
  
          //Finally, close the file pointer.
          fclose($fp);
  
          $response = $response-&gt;withHeader('Content-Type', 'text/csv; charset=utf-8');
          $response = $response-&gt;withHeader('Content-Disposition', 'attachment; filename="file.csv"');
  
          $stream = fopen('php://memory', 'r+');      
  
          return $response-&gt;withBody(new \Slim\Http\Stream($stream));
  </code></pre>