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 happening?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Suggestion from my experience) :
- verify that your file erb is saved in utf-8
- I recomend you to use number_to_currency method
回答2:
Are you outputting HTML? If so you need to escape the character <%= f.label :cost, "Cost (£/m)" %>
回答3:
Either send your page with UFT-8 encoding, or send the pound sign as £
(or £
if you're sending XML rather than HTML).