TCPDF UTF-8. Lithuanian symbols not showing up

前端 未结 15 723
-上瘾入骨i
-上瘾入骨i 2020-12-01 06:47

Im using latest TCPDF version(5.9). But have some strange problems with encoding. I need Lithuanian language symbols like: ąčęėįšųūž. But get only few of it. Other remain li

15条回答
  •  悲&欢浪女
    2020-12-01 07:10

    You u have problem to read character like Karnātaka from database and display like this karn?taka I mean "?" which we don't want then do following things :

    1. Define charset for the connection (mysql_set_charset()):

      $con = mysql_connect("localhost","root","");
      
      if (!$con)
      {
          die('Could not connect: ' . mysql_error());
      }
      mysql_select_db("database_name", $con) or die(mysql_error());
      mysql_set_charset('utf8',$con);
      
    2. Use $pdf->SetFont('DejaVuSerif', '', 10); instead of $pdf->SetFont('helvetica', 'B', 12);

      • For TCPDF Library of the PHP read character like Rājasthān instead of R?jasth?n from database

提交回复
热议问题