I'm trying to display strings of text fetched from a database in a PDF document correctly. What I can't figure out is the following.
I'm using fpdf and html2pdf for the generation of the PDF document. After I fetched my information from my DB I use:
iconv('UTF-8', 'windows-1252', $data);
This displays correctly in the PDF document if I use:
$pdf->Cell();
But when I use:
$pdf->WriteHtmlCell();
it seems that it has decoding issues. It seems to be in another charset because ù turns into ù and Ä into Ä and so on. I have tried to convert it to UTF-8 (which it is originally in) or ISO, but I keep getting the same result. When I run a
mb_detect_encoding();
on the string it always comes back as ASCII (that is UTF-8?).
Is WriteHtmlCell();
using another encoding?
答案 0 :(得分:-1)
试试这个
html_entity_decode($your_data, ENT_XHTML,"ISO-8859-1");