Ruby on Rails - £ sign troubles

前端 未结 3 1175
囚心锁ツ
囚心锁ツ 2021-01-15 14:26

I have <%= f.label :cost, \"Cost (£/m)\" %> in a form. When the form is rendered the \"£\" sign comes out as �. I am using utf-8 encoding. Why is this ha

相关标签:
3条回答
  • 2021-01-15 14:59

    Suggestion from my experience) :

    1. verify that your file erb is saved in utf-8
    2. I recomend you to use number_to_currency method
    0 讨论(0)
  • 2021-01-15 14:59

    Either send your page with UFT-8 encoding, or send the pound sign as &pound; (or &#163; if you're sending XML rather than HTML).

    0 讨论(0)
  • 2021-01-15 15:07

    Are you outputting HTML? If so you need to escape the character <%= f.label :cost, "Cost (&pound;/m)" %>

    0 讨论(0)
提交回复
热议问题