Text_to_ISO-8859-1_Umlaute_ü

I had some trouble when I would write some text with german Umlaute and
spezial characters like (Ä,Ü,Ö,ü,ö,ä,ß).
Solved the Problem with the following code:
function encodeToIso($string) {
return mb_convert_encoding($string, "ISO-8859-1", mb_detect_encoding($string, "UTF-8, ISO-8859-1, ISO-8859-15", true));
}
$_patientname = encodeToIso($_GET["patientname"]);
$pdf->Write(0,$_patientname );

If you would like to write München you might get München.
With encodeToIso you will get München

$_city = "München";$pdf->Write(0,$_city );
Result: München

$_city = encodeToIso("München");$pdf->Write(0,$_city );
Result: München

Hinterlassen Sie eine Antwort

Sie müssen angemeldet sein, um einen Kommentar abzugeben.


Zur Werkzeugleiste springen