views:

539

answers:

1

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).

+2  A: 

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).

James Healy
I see... I'll try that out.
tybro0103
Where's a good place to find .ttf files?
tybro0103
I suggest you try the DejaVu font family, which supports a fairly large chunk of the Unicode standard. You can find it at: http://dejavu-fonts.org/ (The Prawn gem includes DejaVu Sans, specifically in prawn-core/data/fonts/DejaVuSans.ttf)
Shtééf
The DejaVu had a lot of the characters I needed...didn't have Chinese though. I did find a font called "Arial Unicode MS" already on my mac in the fontbook program that seems to do it all. Thanks!
tybro0103