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 [1552] 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

<pdftemplate name="masterList" pdf_encoding='iso8859-1'> <pagedef PAGE_WIDTH="612" PAGE_HEIGHT="792"> <font face="Helvetica" h="10"/> <LOOP NAME="ROWS"> <section> <row x='30' h="20"> <LOOP NAME='COLUMN'> <textbox w="50%"><VAR NAME="FIRST_NAME"/> <VAR NAME="LAST_NAM +E"/></textbox> </LOOP> </row> </section> </LOOP> </pagedef> </pdftemplate>
The template is just fed the needed (nested) array of hashrefs to properly populate the VARs

In reply to PDF::Template and character encodings by geektron

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.