Search code examples
ruby-on-railspdfutf-8prawnprawnto

Prawn & Prawnto Rails PDF generation - UTF-8?


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


Solution

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