|P is for Practical|
PDF::Template and character encodingsby geektron (Curate)
|on Oct 15, 2007 at 21:28 UTC||Need Help??|
geektron has asked for the
wisdom of the Perl Monks concerning the following question:
I've googled, I've super-searched, yet I still can't find a working solution to a character set problem.
I have accented characters (á, for example) stored in a mysql database. HTML rendering is fine without converting the characters to HTMLEntities, but when I try to create a PDF with the same data and PDF::Template, I get a mangled "~Aj" combination.
From this google groups thread, setting a pdf_encoding in the xml template would be sufficient, e.g.:
<pdftemplate name="masterList" pdf_encoding='ISO-8859-1'>
But when I add pdf_encoding to my template, I get the following error:
PDFlib Error  PDF_findfont: Font 'Helvetica' with encoding 'ISO-8859-1': Couldn't find encoding 'ISO-8859-1'
I've tried 'latin1', 'iso-8859-1', and 'utf-8' as valid encodings, but each one throws the above error (with the encoding substituted, of course).
I'm presuming the error is with PDFlib (it's throwing the error), but I'm hoping someone here has dealt with the same (or similar) issue and can give me a pointer or two.
EDIT 1) condensed template.xml