PDF::Writer's documentation is very clear about this: PDF does not
support UTF-8, and that's probably what you're trying to use. Use
substitution character maps instead (the example code in _The Ruby
Way_ 2nd Edition talks about how to use this). UTF-16 support will be
added to PDF::Writer at some point in the future.
-austin
That I can't answer. If you're using MySQL, it's partially because
MySQL is dumber than dirt 99% of the time. You need to make sure
you're encoding things properly and you may need to use iconv to
switch encodings around, or build your substitution character maps to
reflect what's actually stored in your database (which is easier than
it sounds).
I'll be getting back to PDF::Writer development in the new year and
one of the things I want to allow for is multiple instances of the
same font with different character maps. That will go a long way
toward delaying the need for UTF-16 support (because that's very
*hard* to do).
-austin
Hi Austin,
Austin Ziegler wrote:
I'll be getting back to PDF::Writer development
in the new year and one of the things I want to ...
I've been using PDF::Writer, very happily, to produce PDFs. Now I've been given a requirement to include the XML file that the PDF documents are based on into the PDF file itself. Any chance you're interested in PDF::Writer having that capability? I'd be interested in helping with / doing the work.
Thanks for all the work you've already done. It's a great tool!
Best regards,
Bill
Except that this is probably *exactly* why the OP is having problems
with PDF::Writer and the strings being garbled. PDF::Writer does not
AND WILL NEVER support UTF-8 (it will support UTF-16). You will need
to use iconv to convert from UTF-8 to a suitable single-byte encoding
in order to print in PDF::Writer.
-austin
It's actually supported by the underlying specification. UTF-8 isn't.
I'm not going to convert your data for you. I might do so in Ruby
1.9.1 when I can depend on the encoding attached to the strings, but
not before.
-austin