Add an encoding parameter to URLEncoder.encode() and be explicit about the encoding wherever Tomcat uses this method.