setting charset using ini_set

This commit is contained in:
Alec Höfler 2022-05-06 08:14:24 +02:00
parent 3c27278e30
commit c95472f079
No known key found for this signature in database
GPG key ID: BE83D6C1099F2835
2 changed files with 7 additions and 14 deletions

View file

@ -1,5 +1,7 @@
<?php
ini_set('mbstring.internal_encoding', 'UTF-8');
//Database & secrets
use chillerlan\QRCode\QRCode;
use Mpdf\Mpdf;
@ -118,7 +120,7 @@ $data = '<!doctype html>
</tr>
<tr>
<td class="td_desc">Name</td>
<td>' . sonderzeichen($row2["first_name"]) . "&nbsp;" . sonderzeichen($row2["last_name"]) . '</td>
<td>' . $row2["first_name"] . "&nbsp;" . $row2["last_name"] . '</td>
</tr>
<tr>
<td class="td_desc">Bestelldatum</td>
@ -130,7 +132,7 @@ $data = '<!doctype html>
</tr>
<tr>
<td class="td_desc">Kontakt</td>
<td>' . (($row2["paypal_token"] != "") ? ($row2["email"] . "&nbsp;/ &nbsp;" . $row2["phone"]) : "-") . '</td>
<td>' . (($row2["paypal_token"] != "") ? ($row2["email"] . "&nbsp;/ &nbsp;" . $row2["phone"]) : "-") . '</td>
</tr>
<tr>
<td class="td_desc">Vorstellung</td>
@ -168,16 +170,4 @@ try {
$mpdf->Output();
} catch (MpdfException $ex) {
echo 'Exception abgefangen: ', $ex->getMessage(), "\n<br/>";
}
function sonderzeichen($string): string
{
$res = $string;
$res = str_replace("ä", "ae", $res);
$res = str_replace("ü", "ue", $res);
$res = str_replace("ö", "oe", $res);
$res = str_replace("Ä", "Ae", $res);
$res = str_replace("Ü", "Ue", $res);
$res = str_replace("Ö", "Oe", $res);
return str_replace("ß", "ss", $res);
}

View file

@ -1,5 +1,8 @@
<?php
ini_set('mbstring.internal_encoding', 'UTF-8');
//Database & secrets
include "config.php";