# URL-encoding and decoding on Rails

**URL:** <https://www.ruby-forum.com/t/url-encoding-and-decoding-on-rails/163620>\
**Category:** Rails\
**Created:** [March 23, 2009, 9:22am UTC](https://www.ruby-forum.com/t/url-encoding-and-decoding-on-rails/163620 "2009-03-23T09:22:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![evan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/54ee81/32.png) [@evan](https://www.ruby-forum.com/u/evan)\
**Post date:** [March 23, 2009, 9:22am UTC](https://www.ruby-forum.com/t/url-encoding-and-decoding-on-rails/163620/1 "2009-03-23T09:22:06Z")

</div>

I have a URL parameter that has special characters on it, so I do URL  
encoding as such:

my\_url(:email =\> CGI.escape(“removed\_email\_address@domain.invalid”)

Now, I would expect to call a CGI.unescape(params[:email]) on the  
action receiving this parameter, and this is true according to my  
functional tests.

But when I tested this on the browser, it failed because, apparently,  
I didn’t need to do any URL-decoding, and when I did it gave me  
“someemail+extension [mail.com](http://mail.com)”.

Is there a built-in URL-decoding on the controller side? If so, how is  
it that it doesn’t work on my functional tests.

I tested this on Safari and Firefox 3 browser, by the way.
