[
https://issues.apache.org/jira/browse/WICKET-2007?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sven Meier updated WICKET-2007:
-------------------------------
Description:
When Wicket sends a redirect, it doesn't encode the URL of the "Location:"
header - it just writes it out as it is.
Because a redirect does not contain encoding information, the browser cannot
correctly decode containing umlauts.
Setting a contentType seems not to be relavant in a response with HTTP status
3xx , both IE and Firefox seem to disregard it.
Thus I propose, that WebResponse#redirect(String) should always encode the
given URL according to IRequestCycle#responseRequestEncoding or perhaps fixed
to "UTF-8".
I'm currently using a subclass of WebResponse which utiilizes a tweaked
WicketURLEncoder to encode all umlauts:
public void redirect(String url) {
url = redirectEncoder.encode(url);
super.redirect(url);
}
// don't encode any delimiter
private static final WicketURLEncoder redirectEncoder = new
WicketURLEncoder(-1) {
{
dontNeedEncoding.set(' ');
dontNeedEncoding.set('/');
dontNeedEncoding.set('?');
dontNeedEncoding.set('&');
dontNeedEncoding.set('=');
dontNeedEncoding.set('+');
dontNeedEncoding.set(';');
}
};
Note that specifying the URIEncoding on the Tomcat connector (as required for
Ajax requests) does *not* solve the problem.
(http://wiki.apache.org/tomcat/FAQ/Connectors#Q8)
(http://cwiki.apache.org/WW/how-to-support-utf-8-uriencoding-with-tomcat.html)
was:
A redirect does not contain encoding information - contentType seems to be
ignored by IE and Firefox.
Neither does Wicket encode the URL of a redirect according to
IRequestCycle#responseRequestEncoding.
Thus the browser cannot correctly decode umlauts in a redirect's target.
Thus I propose, that WebResponse#redirect(String) should always encode the
given URL.
I'm currently using a subclass of WebResponse which utiilizes a tweaked
WicketURLEncoder to encode all umlauts:
public void redirect(String url) {
url = redirectEncoder.encode(url);
super.redirect(url);
}
// don't encode any delimiter
private static final WicketURLEncoder redirectEncoder = new
WicketURLEncoder(-1) {
{
dontNeedEncoding.set(' ');
dontNeedEncoding.set('/');
dontNeedEncoding.set('?');
dontNeedEncoding.set('&');
dontNeedEncoding.set('=');
dontNeedEncoding.set('+');
dontNeedEncoding.set(';');
}
};
Note that specifying the URIEncoding on the Tomcat connector does *not* solve
the problem.
(http://wiki.apache.org/tomcat/FAQ/Connectors#Q8)
Remaining Estimate: 1h
Original Estimate: 1h
> redirect with umlauts fails
> ---------------------------
>
> Key: WICKET-2007
> URL: https://issues.apache.org/jira/browse/WICKET-2007
> Project: Wicket
> Issue Type: Improvement
> Components: wicket
> Affects Versions: 1.3.5, 1.4-RC1
> Reporter: Sven Meier
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> When Wicket sends a redirect, it doesn't encode the URL of the "Location:"
> header - it just writes it out as it is.
> Because a redirect does not contain encoding information, the browser cannot
> correctly decode containing umlauts.
> Setting a contentType seems not to be relavant in a response with HTTP status
> 3xx , both IE and Firefox seem to disregard it.
> Thus I propose, that WebResponse#redirect(String) should always encode the
> given URL according to IRequestCycle#responseRequestEncoding or perhaps fixed
> to "UTF-8".
> I'm currently using a subclass of WebResponse which utiilizes a tweaked
> WicketURLEncoder to encode all umlauts:
> public void redirect(String url) {
> url = redirectEncoder.encode(url);
> super.redirect(url);
> }
> // don't encode any delimiter
> private static final WicketURLEncoder redirectEncoder = new
> WicketURLEncoder(-1) {
> {
> dontNeedEncoding.set(' ');
> dontNeedEncoding.set('/');
> dontNeedEncoding.set('?');
> dontNeedEncoding.set('&');
> dontNeedEncoding.set('=');
> dontNeedEncoding.set('+');
> dontNeedEncoding.set(';');
> }
> };
> Note that specifying the URIEncoding on the Tomcat connector (as required for
> Ajax requests) does *not* solve the problem.
> (http://wiki.apache.org/tomcat/FAQ/Connectors#Q8)
> (http://cwiki.apache.org/WW/how-to-support-utf-8-uriencoding-with-tomcat.html)
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.