Pergunta

I am trying to output currency symbols in Prawn with a helper method like this:

def price(number)
  @view.number_to_currency(number, :unit => "€")
end

I then use it like this:

price(@invoice.total)

Unfortunately it's not working and instead of I get € in my PDF documents.

(The same number_to_currency function works great outside of Prawn by the way.)

Can anybody help?

Foi útil?

Solução 2

OK, I solved it by just using special characters like instead of HTML-entities like €. I had to tweak my app a bit to achieve that, though.

Outras dicas

Have a look at this railscast under the heading "Formatting The Currency Fields". Looks like you don't have to escape the the currency symbols.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top