i am getting adding some of parameter in query string.value of these param can be “a%%”,”%” etc.on java code side .while parsing query parameter i m getting char conversionexception
as shown below in exception log.
13:14:39,555 ERROR [STDERR] java.io.CharConversionException: EOF
13:14:39,555 ERROR [STDERR] at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:119)
13:14:39,555 ERROR [STDERR] at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:87)
13:14:39,555 ERROR [STDERR] at org.apache.tomcat.util.http.Parameters.processParameters(Paramete
rs.java:428)
13:14:39,555 ERROR [STDERR] at org.apache.tomcat.util.http.Parameters.processParameters(Paramete
rs.java:515)
13:14:39,555 ERROR [STDERR] at org.apache.tomcat.util.http.Parameters.handleQueryParameters(Para
meters.java:298)
:14:39,555 ERROR [STDERR] at org.apache.coyote.tomcat4.CoyoteRequest.parseRequestParameters(Co
yoteRequest.java:1933)
what should i do?
It sounds like the query string being sent to your Java code is malformed. The percent sign is special in query strings: It introduces a two-digit hexadecimal number identifying a character. For instance,
%20is a space. To put a percent sign in a query string correctly, one uses%25(character 25h is the percent sign in Unicode). If the query string you’re processing really, literally has%%in it, then it is malformed and you’ll want to have the side sending it fixed.Edit: In your comment you say you’re the one sending the invalid query string. To properly encode a query parameter, use the
encodeURIComponentJavaScript function: