I develop an application that's deployed to a tomcat instance that also hosts other applications. For their purpose, the connector on port 80 has its URIEncoding set to "UTF-8". I would like to find a way to override this setting for my servlet, without specifying another connector on another port. I have tried using a tomcat filter to set the filter as follows:
@Override
public void doFilter(final ServletRequest request, final ServletResponse response,
final FilterChain filterChain) throws IOException, ServletException {
request.setCharacterEncoding(encoding);
filterChain.doFilter(request, response);
}
But it doesn't change anything. My ISO-8859-1 encoded String contains unexpected characters when it lands in the servlet.