大虾Prawnto Rails PDF生成-UTF-8? [英] Prawn & Prawnto Rails PDF generation - UTF-8?
问题描述
我正在使用ruby,prawn和prawnto动态生成包含其他语言的pdf文本.我似乎看不到任何带有非英语字符的语言文字.它不会引发任何错误...只是显示一堆破折号而不是字符.大虾在其主页上吹嘘关于UTF-8支持,因此我不明白为什么这是个问题.我正在使用ruby 1.8.6(engineyard).
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).
推荐答案
要使Unicode正常工作,您需要加载包含所需字符的TTF字体.
For Unicode to work you need to load a TTF font that has the characters you require.
默认的Helvetica字体仅支持ASCII(加上一些附加功能).
The default Helvetica font only supports ASCII (plus a few extras).
这篇关于大虾Prawnto Rails PDF生成-UTF-8?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!