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
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
添加<meta charset="UTF-8">
到 HTML 视图的顶部或布局的头部。
您可以作为选项传递:
encoding: 'utf8'
您也可以将其添加为 wickedpdf 中的选项
WickedPdf.new.pdf_from_string(
render :pdf => "Paper",
:template => "paper/paper.html",
:page_size => 'A4',
formats: :html, encoding: 'utf8',
:margin => {:top => 40}
)
要解决此问题,请在视图开头添加以下行:
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
您可以参考此链接 - https://github.com/mileszs/wicked_pdf/issues/35了解更多详情。