S.redirectTo doesn't seem to work with non-ascii characters, although I haven't been able to figure out why so far.For example, when calling S.redirectTo("/ß") the browser is redirected to /%DF instead of /%C3%9F. There doesn't seem to be any problem with encJs("/ß") == "/\u00df" and throwing a raw <script>window.location = "/\u00df";</script> into a template gives the desired result. So I'm guessing my issue has something to do with URLRewriter?
/**
* 301 Redirect.
*/
case class PermRedirectResponse(uri: String, request: Req, cookies: HTTPCookie*) extends LiftResponse {
def toResponse = InMemoryResponse(Array(), List("Location" -> uri), cookies.toList, 301)
}
/**
* 307 Redirect.
*/
case class TemporaryRedirectResponse(uri: String, request: Req, cookies: HTTPCookie*) extends LiftResponse {
def toResponse = InMemoryResponse(Array(), List("Location" -> uri), cookies.toList, 307)
}
The only thing going on here is setting the Location header to the uri. I'm betting the location header conversion stuff is not done with the correct character encoding by whatever containers you're using. For kicks, try adding a header "X-FooBar" with the value "/ß" and see what comes out the other side.
Is there a setting somewhere that would resolve this or some other simple way to get this working?Cheers,Ben
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code
Thanks David! My 3am code-tracing skills obviously need some work. :)
I can't find anything anywhere about fixing the issue at the container level with Jetty 6, 7 or 8. The simplest solution seems to be to just S.redirectTo("/' + URLEncoder.encode("non-ascii string", "UTF-8")).
Cheers,Ben--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code