I have <%= f.label :cost, "Cost (£/m)" %> in a file _form.html.erb. When the form is rendered instead of getting "£" I just get "£" being rendered. I am using utf-8 encoding. Why is this happening? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Nov 10, 12:54 pm, Bill Morrison <i...-Q97G1sGZNQdeoWH0uzbU5w@public.gmane.org> wrote:> I have <%= f.label :cost, "Cost (£/m)" %> in a file > _form.html.erb. When the form is rendered instead of getting "£" I > just get "£" being rendered. I am using utf-8 encoding. Why is > this happening?If you''re on a version of rails that has the automatic xss stuff enabled you should call html_safe on that string, or rails will pass it through h for you Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Bill Morrison wrote in post #960534:> I have <%= f.label :cost, "Cost (£/m)" %> in a file > _form.html.erb. When the form is rendered instead of getting "" I > just get "£" being rendered. I am using utf-8 encoding. Why is > this happening?Are you using Rails 3, by any chance? If so, then strings get HTML-escaped by default. Either use the literal £ character (probably the best choice) or mark the string as raw. In general, except for <, >, &, and maybe , there''s little reason to use &entities in HTML files these days. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks very much. On Nov 10, 3:26 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Bill Morrison wrote in post #960534: > > > I have <%= f.label :cost, "Cost (£/m)" %> in a file > > _form.html.erb. When the form is rendered instead of getting "" I > > just get "£" being rendered. I am using utf-8 encoding. Why is > > this happening? > > Are you using Rails 3, by any chance? If so, then strings get > HTML-escaped by default. Either use the literal £ character (probably > the best choice) or mark the string as raw. > > In general, except for <, >, &, and maybe , there''s > little reason to use &entities in HTML files these days. > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.