Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wicked_pdf and utf8 symbol

In my generated pdf I get this

0,00 €

instead of

0,00 €

Application.html.erb

  <meta charset="utf-8">
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />

show.html.erb

<%=number_to_currency item.total%>
like image 998
sparkle Avatar asked Apr 22 '14 21:04

sparkle


2 Answers

respond_to do |format|
  format.html { render template: 'invoices/show' }
  format.pdf  do
    render pdf: 'invoices/show',
           template: 'invoices/show', 
           formats: :HTML, 
           encoding: 'utf8'
  end
end
like image 55
sparkle Avatar answered Oct 05 '22 12:10

sparkle


Still i can see the special characters in the PDF. Below is my code

pdf = WickedPdf.new.pdf_from_string(page_html,:page_size => "A3") 

  send_data(pdf, 
    :filename => "my_pdf_name.pdf", 
    :formats => 'HTML', 
    :encoding => 'utf8',
    :disposition => 'attachment') 
  end
like image 43
Lokesh S Avatar answered Oct 05 '22 12:10

Lokesh S