# Suppress HTML escaping in link\_to(:title)?

**URL:** <https://www.ruby-forum.com/t/suppress-html-escaping-in-link-to-title/52914>\
**Category:** Rails\
**Created:** [January 20, 2006, 8:16am UTC](https://www.ruby-forum.com/t/suppress-html-escaping-in-link-to-title/52914 "2006-01-20T08:16:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trojanek\_Michael\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e480ec/32.png) [@Trojanek\_Michael\_M](https://www.ruby-forum.com/u/Trojanek_Michael_M)\
**Post date:** [January 20, 2006, 8:16am UTC](https://www.ruby-forum.com/t/suppress-html-escaping-in-link-to-title/52914/1 "2006-01-20T08:16:56Z")

</div>

Hi guys,

I’m new to this list and it seems you are my last hope.

How can I prevent Rails from automatically escaping HTML entities when  
creating a hyperlink?

You know, link\_to( … :title =\> ‘This is „quoted“’) returns  
‘This is „quoted“’ because Rails escapes the ampersands to  
&.

Is there a way I can stop/alter this behaviour so I can use these  
numeric references in my title tag?

Kind regards

.mitro

---

<div class="post-metadata">

**Author:** ![Trojanek\_Michael\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e480ec/32.png) [@Trojanek\_Michael\_M](https://www.ruby-forum.com/u/Trojanek_Michael_M)\
**Post date:** [January 21, 2006, 4:00pm UTC](https://www.ruby-forum.com/t/suppress-html-escaping-in-link-to-title/52914/2 "2006-01-21T16:00:19Z")

</div>

2006/1/20, Trojanek Michael M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Is there a way I can stop/alter this behaviour so I can use these  
> numeric references in my title tag?

I think the easiest way would be to write out the link by hand, using  
url\_for instead of link\_to.

Something like: \<a href=\<%= url\_for … %\> title=“\<%=@title%\>” /\>

Though I think you have a bug somewhere else. Why do you have escaped  
HTML stored as data? Are you escaping input? (a bad idea)

The only reason I can think of at the moment to store escaped HTML  
would be as a caching thing, perhaps you could use the built in Rails  
caching?

Douglas
