AxelDerks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Feb-09 11:18 UTC
Problem with special characters in input field
Hello, In my application, a template can be created. Sometime, this template would include a special character like e.g. the Euro sign so the user will fill in € When the field is displayed again in edit mode Rails generates following code: <input id="account_template" name="account[template]" size="30" type="text" value="test € test" /> The browser will replace the € sign by the real euro sign and when the user hits save, this euro sign (so not the HTML special character code) will be saved in the database. This is not the intention. So my question: how can I display special HTML codes as plain html code (text) which is in the initial VALUE in an input box instead of the code beeing replaced by the symbol itself? Thank you in advance. Axel --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You need to escape the html with h() On Feb 9, 6:18 am, "AxelDe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <AxelDe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello, > > In my application, a template can be created. Sometime, this template > would include a special character like e.g. the Euro sign so the user > will fill in € > > When the field is displayed again in edit mode Rails generates > following code: > > <input id="account_template" name="account[template]" size="30" > type="text" value="test € test" /> > > The browser will replace the € sign by the real euro sign and > when the user hits save, this euro sign (so not the HTML special > character code) will be saved in the database. This is not the > intention. > > So my question: how can I display special HTML codes as plain html > code (text) which is in the initial VALUE in an input box instead of > the code beeing replaced by the symbol itself? > > Thank you in advance. > > Axel--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---