Prawn & Prawnto Rails PDF generation - UTF-8?

tybro0103 picture tybro0103 · Jan 20, 2010 · Viewed 7k times · Source

I'm using ruby, prawn, and prawnto to dynamically generate pdf's containing text in other languages. I can't seem to get any text in languages with non-english characters to show up. It doesn't throw any errors...just shows a bunch of dashes instead of characters. Prawn brags on its homepage about UTF-8 support so I don't see why this is a problem. I'm using ruby 1.8.6 (engineyard).

Answer

James Healy picture James Healy · Jan 21, 2010

For Unicode to work you need to load a TTF font that has the characters you require.

The default Helvetica font only supports ASCII (plus a few extras).