Hi,
the thing is: the whole escaping and encoding is done by Spring. Shouldn't Spring handle this in a consistent manner? Or am I at least able to specify separately, which encoding should be used for path variables and which for request parameters?
To give another example:
The controller:
Code:
package example;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class TestController {
@RequestMapping("")
public String index() {
return "redirect:/test/für";
}
@RequestMapping("/{value}")
public ModelAndView test(@PathVariable("value") String value) {
ModelAndView mv = new ModelAndView("test");
mv.addObject("value", value);
return mv;
}
}
And the JSP:
Code:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<p>provided: <spring:escapeBody>${value}</spring:escapeBody></p>
<p><a href="<spring:url value="/test/{value}">
<spring:param name="value" value="für" />
</spring:url>">test with umlaut</a></p>
<p><a href="/test/f%C3%BCr">this is the correct link</a></p>
</body>
</html>
As stated above - everything is done by Spring, but not even the redirect results in a correct display of the value in the JSP when CharacterEncodingFilter is used.
So what can I do?
Chris