[英]Rails: respond_to PDF and HTML that has text as well as Emojis
I'm trying to create & download a html file in pdf format which has paragraph containing text along with Emoticons (Emojis). 我正在尝试创建和下载pdf格式的html文件,该文件的段落包含文字以及表情符号(表情符号)。 In output I'm able to get correct text but not the Emojis. 在输出中,我能够获得正确的文本,但不能获得表情符号。
I have dashboard_controller.rb
that contains the following function. 我有包含以下功能的dashboard_controller.rb
。
def download_dashboard
respond_to do |format|
format.html
format.pdf do
html = render_to_string(:layout => false, :action => "download_dashboard.html.haml")
send_data(html, :filename => "dashboard.html", :type => 'application/pdf')
end
end
end
Here, download_dashboard.html.haml
has the following code 在这里, download_dashboard.html.haml
具有以下代码
%p= Hello, World!😃
But the download file dashboard.html
output I'm getting is something different like this: 但是我得到的下载文件dashboard.html
输出是这样的:
The correct output should be like this: 正确的输出应如下所示:
How can I achieve the correct output? 如何获得正确的输出?
在download_dashboard.html.haml
包含char ='utf-8':
%meta{:charset => "utf-8"}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.