0

I'm currently working on an automatical PDF Form. Everything is working already ,but the Problem is that when i trie to echo the price or name the Umlauts like ä,ö,ü,ß and so on wont show. Even the € sign wont show.I'm trying to use GET from an posted URL. So i need help.

Get-Parameters:

    $name = $_GET['name'];
    $geb = $_GET['geb'];
    $strasse = $_GET['strasse'];
    $plz = $_GET['plz'];
    $beruf = $_GET[urlencode(beruf)];
    $tel = $_GET['tel'];
    $mail = $_GET['mail'];
    $ek = $_GET['ek'];
    $vorbesitzer = $_GET['vorbesitzer'];
    $vkpreis = $_GET['vkpreis'];
    $sonstige = $_GET['sonsitge'];
$marke = $_GET[urlencode('marke')];
    $modell = $_GET['modell'];
    $motor = $_GET['motor'];
    $km = $_GET['km'];
    $fin = $_GET['fin'];
    $ez = $_GET['ez'];

For Testing i only have two params in my url:

erstellen?eknr=88&marke=Skoda&beruf=Medienfachmannäöü€$

When i use urlencode it looks like this:

erstellen?eknr=88&marke=Skoda&beruf=Medienfachmannäöü€$

How i create my url:

<script type="text/javascript">
    window.location = "erstellen?<?php $conn = new mysqli($servername, $username, $password, $dbname);
$sql = "SELECT * FROM `Fahrzeugverkauf` WHERE EKNR = $ek";
$result = $conn->query($sql);

if ($result->num_rows > 0) {

     while($row = $result->fetch_assoc()) {
$query_string = 'eknr=' . rawurlencode ($row[EKNR]) . '&marke=' . rawurlencode ($row[Marke]). '&beruf=' . rawurlencode ($beruf);
         echo htmlentities($query_string) ;
     }
} ?>"

My output looks like that:

  $pdf->useTemplate($tplIdx, 0, 0, 210);
  $pdf->SetFont('Times','B', 10);
        $pdf->SetXY(158, 4.2);
    $pdf->Write(4, '13-12-2016');
        $pdf->SetXY(36.2, 24.6);
    $pdf->Write(4, $name);
        $pdf->SetXY(162.6, 24.7);
    $pdf->Write(4,$geb);
            $pdf->SetXY(35.3, 31.3);
    $pdf->Write(4,$strasse);
                $pdf->SetXY(85, 31.3);
    $pdf->Write(4,$plz);
            $pdf->SetXY(31.2, 37.6);
    $pdf->Write(4,urldecode($beruf));
                $pdf->SetXY(155, 37.6);
    $pdf->Write(4,'?????üüßßßßüüü€??');
                    $pdf->SetXY(54, 59.5);
    $pdf->Write (4, urldecode($marke));
                        $pdf->SetXY(102, 59.5);

    $pdf->Write(4,$modell);
                        $pdf->SetXY(40, 66.2);
    $pdf->Write(4,$ez);
                        $pdf->SetXY(78, 66.2);
    $pdf->Write(4,$motor);
                            $pdf->SetXY(122.8, 66.2);
    $pdf->Write(4,$fin);
                            $pdf->SetXY(70, 79.2);
    $pdf->Write(4,$km);
                            $pdf->SetXY(38, 85.3);
    $pdf->Write(4,$vorbesitzer);
       $pdf->SetXY(52, 92);
    $pdf->Write(4,$vkpreis);
    $pdf->Image('checkbox.jpg', 63.8, 130,5,5);
    $pdf->Image('check-box.png', 63.8, 160,5,5);
    $pdf->Image('checkbox.jpg', 63.8, 192.5,5,5);
    $pdf->Image('check-box.png', 63.8, 227.6,5,5);

So the problem I am facing is that i cant use Meta-parameters since im using FPDF. Anyone Can Help?

1 Answers1

0

You may have to set the correct encoding, UTF-8, both in your input file and in FPDF. You also need to set the file encoding to UTF-8, if not happened already.

You may use ISO-8859-1 (Latin 1), but I would not recommend that.

webmonkey
  • 1,083
  • 1
  • 15
  • 33
  • FPDF doesnt support UTF-8. But i set it on the right encoding, if i will just put umlauts in without anything just the write param it outputs it correctly. But when i get it from the url it looks like this: Medienfachmannäöü€ – Max Bogatec Dec 15 '16 at 10:30
  • Really? Damn, how is this possible? Then you should go along with utf8_encode/utf8_decode... not the finest, but should work as expected. – webmonkey Dec 15 '16 at 10:32
  • Have a look here: http://stackoverflow.com/questions/3514076/special-characters-in-fpdf-with-php – webmonkey Dec 15 '16 at 10:33
  • Glad it worked, although i don't understand why FPDF doesn't support UTF-8 ;-) – webmonkey Dec 15 '16 at 11:40