# How to prevent Rails from url-encoding

**URL:** <https://www.ruby-forum.com/t/how-to-prevent-rails-from-url-encoding/118771>\
**Category:** Rails\
**Created:** [October 30, 2007, 8:07pm UTC](https://www.ruby-forum.com/t/how-to-prevent-rails-from-url-encoding/118771 "2007-10-30T20:07:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![threeeyedfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a587f6/32.png) [@threeeyedfish](https://www.ruby-forum.com/u/threeeyedfish)\
**Post date:** [October 30, 2007, 8:07pm UTC](https://www.ruby-forum.com/t/how-to-prevent-rails-from-url-encoding/118771/1 "2007-10-30T20:07:16Z")

</div>

I have a route  
map.connect ‘browse/:languages’, :controller =\> ‘browse’, :action =\>  
‘index’  
where I expect :languages to be something like ‘en+jp+zh\_tw’ so that  
I can later do  
languages = params[:languages].split(’ ‘)  
(because + is an equivalent of a space in a url). But Rails does url-  
encode all params, and I get ‘en%2Bjp%2Bzh\_tw’.  
Of course, I could .split(’%2B’), but the url is getting so ugly!  
Is there a method to prevent Rails from url-encoding in this case?

/Damian

---

<div class="post-metadata">

**Author:** ![threeeyedfish](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/a587f6/32.png) [@threeeyedfish](https://www.ruby-forum.com/u/threeeyedfish)\
**Post date:** [October 30, 2007, 11:33pm UTC](https://www.ruby-forum.com/t/how-to-prevent-rails-from-url-encoding/118771/2 "2007-10-30T23:33:14Z")

</div>

On Oct 30, 2550 BE, at 22:05, Damian T. wrote:

> I have a route  
> map.connect ‘browse/:languages’, :controller =\> ‘browse’, :action =\>  
> ‘index’  
> where I expect :languages to be something like ‘en+jp+zh\_tw’ so that  
> I can later do  
> languages = params[:languages].split(’ ‘)  
> (because + is an equivalent of a space in a url). But Rails does url-  
> encode all params, and I get ‘en%2Bjp%2Bzh\_tw’.  
> Of course, I could .split(’%2B’), but the url is getting so ugly!  
> Is there a method to prevent Rails from url-encoding in this case?

I got with the problem by joining languages by a space instead of a  
plus sign. It then becomes a nice + in a url.  
Sorry for disturbance.
