# HTML in error messages

**URL:** <https://www.ruby-forum.com/t/html-in-error-messages/174260>\
**Category:** Rails\
**Created:** [August 23, 2009, 10:35pm UTC](https://www.ruby-forum.com/t/html-in-error-messages/174260 "2009-08-23T22:35:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e99b99/32.png) [@chero](https://www.ruby-forum.com/u/chero)\
**Post date:** [August 23, 2009, 10:35pm UTC](https://www.ruby-forum.com/t/html-in-error-messages/174260/1 "2009-08-23T22:35:42Z")

</div>

Hey All,

Rails escapes HTML in error message. Does anyone know a way to print an  
error message without it being escaped? Consider:

errors.add\_to\_base ‘Sorry, we were unable to parse the feed you  
provided.  
Please double check the URL you have provided. Email the webmaster for more information.’

Thanks in advance,  
Jim  
[http://www.thepeoplesfeed.com/contribute](http://www.thepeoplesfeed.com/contribute)

---

<div class="post-metadata">

**Author:** ![chero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e99b99/32.png) [@chero](https://www.ruby-forum.com/u/chero)\
**Post date:** [August 24, 2009, 8:04pm UTC](https://www.ruby-forum.com/t/html-in-error-messages/174260/2 "2009-08-24T20:04:48Z")

</div>

Off the top of my head a solution to this is using a translation file,  
it doesn’t get escaped AFAIK:

> **[Rails Internationalization (I18n) API — Ruby on Rails Guides](https://guides.rubyonrails.org/i18n.html)**
>
> Rails Internationalization (I18n) APIThe Ruby I18n (shorthand for internationalization) gem which is shipped with Ruby on Rails (starting from Rails 2.2) provides an easy-to-use and extensible framework for translating your application to a single...

HTH,  
Nicholas
