Added charset header and BOM to utf-8 csv exports

This commit is contained in:
Frank Schubert
2024-11-05 13:53:50 +01:00
parent ed95e9bb7c
commit 1f3ef5246f
8 changed files with 15 additions and 15 deletions
@@ -1,8 +1,8 @@
<?php
header("Content-type: text/csv");
header("Content-type: text/csv; charset=utf-8");
header('Content-disposition: attachment; filename="preorder-services-'.$campaign->name.'-'.date("Y-m-d_H-m-s").'.csv"');
?>
Code;Gemeinde;PLZ;Ortschaft;Strasse;Hausnummer;Block;Stiege;Stock;Tuer;Adresszusatz;Adressinfo;Firma;UID;Vorname;Nachname;Kontakt Strasse;Kontakt PLZ;Kontakt Ort;Telefon;Email;Dienstleistung;Data
<?="\u{FEFF}"?>Code;Gemeinde;PLZ;Ortschaft;Strasse;Hausnummer;Block;Stiege;Stock;Tuer;Adresszusatz;Adressinfo;Firma;UID;Vorname;Nachname;Kontakt Strasse;Kontakt PLZ;Kontakt Ort;Telefon;Email;Dienstleistung;Data
<?php foreach($csv as $c):?>
"<?=$c["ucode"]?>";"<?=$c["gemeinde"]?>";"<?=$c["plz"]?>";"<?=$c["ortschaft"]?>";"<?=$c["strasse"]?>";"<?=$c["hausnummer"]?>";"<?=$c["block"]?>";"<?=$c["stiege"]?>";"<?=$c["stock"]?>";"<?=$c["tuer"]?>";"<?=$c["zusatz"]?>";"<?=$c["address_info"]?>";"<?=$c["contact_company"]?>";"<?=$c["contact_uid"]?>";"<?=$c["contact_firstname"]?>";"<?=$c["contact_lastname"]?>";"<?=$c["contact_street"]?>";"<?=$c["contact_plz"]?>";"<?=$c["contact_ort"]?>";"<?=$c["phone"]?>";"<?=$c["email"]?>";"<?=$c["service"]?>";"<?=$c["service_data"]?>"
<?php endforeach;