Decode URL


#1

Hi,

I have a URL with encoded characters, I want them to be decoded.
Is this possible in the routes.rb?

e.g. decoding the @params[category]

map.connect ‘performances/:category’, :controller => ‘performance’,
:action => ‘list_performances’

regards,

Jörg


#2

On Feb 27, 2006, at 3:17 AM, Jörg wrote:

Hi,

I have a URL with encoded characters, I want them to be decoded.
Is this possible in the routes.rb?

e.g. decoding the @params[category]

map.connect ‘performances/:category’, :controller =>
‘performance’, :action => ‘list_performances’

No, this is not possible. I think a before_filter in the
ApplicationController would be your best bet:

before_filter :decode_category

def decode_category
if params[:category]
params[:category] = CGI.unescape(params[:category])
end
end

Duane J.
(canadaduane)
http://blog.inquirylabs.com/