Rails、wicked-pdf gem 和 é à ö字符显示不正确
当我生成包含 é è à 等字符的文本的 PDF 时,我确实得到了有趣的字符。
我知道这一定与编码有关。
我确实在带有这些字符的字符串上尝试了force_encoding(“UTF-8”),但没有成功。
乔尔
When I generate a PDF with text containing characters such as é è à and so on I do get funny characters instead.
I know this must be related to encoding.
I did try force_encoding("UTF-8") on the string with those characters with no success.
joel
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
将
添加到 HTML 视图的顶部或布局的头部。
Add
<meta charset="UTF-8">
to the top of your HTML view or in the head of your layout.您可以作为选项传递:
You can pass as option:
您还可以将其添加为 wickedpdf 中的选项
You can also add it as an option in the wickedpdf
要解决此问题,请在视图开头添加以下行:
您可以参考此链接 - https: //github.com/mileszs/wicked_pdf/issues/35 了解更多详细信息。
To solve this, add the following line at the beginning of your view:
You can refer this link - https://github.com/mileszs/wicked_pdf/issues/35 for more details.