duangejian6657 2016-12-15 09:48
浏览 64
已采纳

PHP - 从链接参数获取变音符号

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条回答 默认 最新

  • dongsu3654 2016-12-15 10:28
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度