i've written a simple php application on a xampp enviroment on my windows desktop. Its a simple output of an html table into a csv file. and it works correctly.
Now i moved the Application to a linux apache server. Now the CSV export also works correctly but when i open it with excel(it's correctly displayed in Notepad) the german umlauts are not displayed. How i said, this worked well on my xampp server. Do you have any idea where my mistake is?
Php default_chartype="utf-8"
<?php
include('func/connect.php');
header("Content-type: text/csv; charset=utf-8");
header("Content-Disposition: attachment; filename=export".time().".csv; charset=utf-8");
header('Content-Transfer-Encoding: binary');
header("Pragma: no-cache");
header("Expires: 0");
$date = explode(" ", $_GET['startDate']);
$monthname= $date[0];
$month=1;
$year= $date[1];
$monthArray = array("January","February","March","April","May","June","July","August","September","October","November","December");
for($i=1;$i<=$monthArray;$i++){
if($monthArray[$i]==$monthname){
$month++;
break;
}
else{
$month++;
}
}
echo "PNR; Vorname; Nachname; Betrag \r\n";
$q = "SELECT mitarbeiter.ID,mitarbeiter.Vorname,mitarbeiter.Nachname, SUM(Betrag) as Betrag FROM mitarbeiter INNER JOIN transaktionen on mitarbeiter.ID= transaktionen.PNR WHERE obsolete IS NULL AND transaktionen.Date BETWEEN '".$year."-".$month."-01' AND '".$year."-".$month."-".cal_days_in_month(CAL_GREGORIAN, $month, $year)."' GROUP BY ID";
$result = mysqli_query($mysqli, $q) or die ('Unable to execute query. '. mysqli_error($q));
while($query = mysqli_fetch_assoc($result)) {
echo '="'.$query["ID"].'";'. $query["Vorname"].";". $query["Nachname"].";". number_format($query["Betrag"], 2, ',', '')."\r\n";
}
?>