# Problem with special characters in input field

**URL:** <https://www.ruby-forum.com/t/problem-with-special-characters-in-input-field/128613>\
**Category:** Rails\
**Created:** [February 9, 2008, 12:19pm UTC](https://www.ruby-forum.com/t/problem-with-special-characters-in-input-field/128613 "2008-02-09T12:19:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 9, 2008, 12:19pm UTC](https://www.ruby-forum.com/t/problem-with-special-characters-in-input-field/128613/1 "2008-02-09T12:19:49Z")

</div>

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:

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

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 9, 2008, 2:10pm UTC](https://www.ruby-forum.com/t/problem-with-special-characters-in-input-field/128613/2 "2008-02-09T14:10:24Z")

</div>

You need to escape the html with h()
