Strange characters in my generated PDF file

I get the characters 􀀊􀀠􀀉􀀉in my PDF file, I deleted \ r \ n \ r \ n \ t, truncated everything, decoded the html objects and split the tags. Nothing helps. The data comes from the MySQL database.

Any help would be appreciated.

+3
source share
7 answers

Check string encoding (using mb_detect_encoding) before adding to pdf, is it a unicode string? Data in MySQL db may be in unicode, but your db connection may use some other encoding.

+2
source

Have you tried using utf8_decode ()? http://php.net/manual/en/function.utf8-decode.php

0

, , .

0

- , :

$str = 'Hello 􀀊 World';
echo str_replace(chr(ord('􀀊')), '[removed]', $str);

:

Hello [removed] World
0

$string = "testContainingSpecialCharsäöüöüäüß";
$pdf->Cell(0,0,$string);

?

0

FPDF Unicode, . http://acko.net/node/56, , , PDF ( TCPDF).

iconv UTF-8 (.. $str = iconv('UTF-8', 'windows-1252', $str);), FPDF.

0

Similar to the result of what happens when you copy / paste text from a Microsoft word. Can a PDF file contain text from an MS Word document by accident? This may be your problem. There are some interesting comments for converting and removing these characters in PHP on the PHP.net website: http://www.php.net/manual/en/function.strtr.php#39383

I just assume that these are MS Word characters in your PDF file.

0
source

Source: https://habr.com/ru/post/1746326/


All Articles