I've got a php site where I export some data into a pdf file. The site uses fpdf to create the pdf file but some special characters doesn't show corretly in the created pdf file.
The tricky thing is that some special characters are printed correctly while others aren't. The default_charset of the site is "iso-8859-1" and the php files are coded in "ANSI". I also printed the array with the info (that I get from the database) and it's ok. So, I guess it's something with the fpdf? But It's strange that the same special character is printed corretly in some places and incorrectly in others.
Thank you :)
EDIT:
I've found out it's in this piece of code that the strings get bad encoded:
foreach ($this->relatorioData['Roteiro'] as $label => $value) {
$this->Cell(55, 4, html_entity_decode($label), 0, 0, 'L', false);
$this->Cell(95, 4, html_entity_decode($value), 0, 1, 'L', false);
}
The strings are alright until the html_entity_decode where only some of them loose the special characters. Do you know what could do this? Should I use other method?
Well, I've found my answer. I needed to change this:
html_entity_decode($text)
To this:
html_entity_decode($label, ENT_COMPAT, 'ISO-8859-1')
This way all my stringd were decoded right.