URL Encode the path parameter for render_exception

If a request is made and path is something like /%d3 we rescue this with
a custom 404 template.

This gets unescaped as {"path"=>"\323"}.

In the case of a RouteNotFound, ApplicationController#render_exception
renders the general/exception_caught template in to the default layout,
which renders the general/_locale_switcher partial.

This partial calls url_for – sending the full params hash as the
argument – so that a user may return to the existing page in their
chosen locale.

The problem is that url_for tries to construct the url with the hash
{:action=>"not_found", :controller=>"general",
:path=>"\323"}.

ApplicationController#sanitize_params re-encodes the path parameter so
that it can be passed through to url_for without trouble.
Merge branch 'issues/1406-render-exception-error' into rails-3-develop