Base Desire Base Desire - 2 years ago 333
PHP Question

html_entity_decode in FPDF(using tFPDF extention)

I am using tFPDF to generate a PDF. The php file is UTF-8 encoded.
I want

for example, to be output in the pdf as the copyright symbol.

I have tried
. When I take the string I am trying to decode and hard-code it in to a different file and decode it, it works as expected. So for some reason it is not being output in the PDF. I have tried output buffering. I am using
(true type fonts).

Link to tFPDF:

I am out of ideas. I tried double decoding, I checked everywhere to make sure it was not being encoded anywhere else.


Answer Source

you need this:

iconv('UTF-8', 'windows-1252', html_entity_decode($str));

the html_entity_decode decodes the html entities. but due to any reason you must convert it to utf8 with iconv. i suppose this is a fpdf-secret... cause in normal browser view it is displayed correctly.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download