# Escape character problem

**URL:** <https://www.ruby-forum.com/t/escape-character-problem/156459>\
**Category:** Rails\
**Created:** [December 28, 2008, 8:21am UTC](https://www.ruby-forum.com/t/escape-character-problem/156459 "2008-12-28T08:21:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [December 28, 2008, 8:21am UTC](https://www.ruby-forum.com/t/escape-character-problem/156459/1 "2008-12-28T08:21:27Z")

</div>

Hi, i need to construct a link as following

“\<a href=”#{CONFIG[‘URLS’][‘Xyz’]}#{url}"#{tag\_options}\>#{name ||  
url}"

But here due to escape character #{url} not give actual value it  
treated as a string. how to solve this ?  
if i do  
“\<a href=”#{CONFIG[‘URLS’][‘xyz’]}\#{url}"#{tag\_options}\>#{name ||  
url}"  
then #{url} gives me proper value but link is wron constructed?

please suggest me solution.

---

<div class="post-metadata">

**Author:** ![sunfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@sunfish](https://www.ruby-forum.com/u/sunfish)\
**Post date:** [December 28, 2008, 9:52am UTC](https://www.ruby-forum.com/t/escape-character-problem/156459/2 "2008-12-28T09:52:11Z")

</div>

Sunny B. wrote:

> Hi, i need to construct a link as following
> 
> “\<a href=”#{CONFIG[‘URLS’][‘Xyz’]}#{url}"#{tag\_options}\>#{name ||  
> url}"
> 
> But here due to escape character #{url} not give actual value it  
> treated as a string. how to solve this ?  
> if i do  
> “\<a href=”#{CONFIG[‘URLS’][‘xyz’]}\#{url}"#{tag\_options}\>#{name ||  
> url}"  
> then #{url} gives me proper value but link is wron constructed?
> 
> please suggest me solution.

Not sure, but there is an “h(…)” function available to ‘escape’ code  
the enclosed content. Have you tried it?
