I have a problem with Java URLDecoder. I avoid String in JavaScript and send it to the Java servlet. Then I decode the escaped string with the following line:
URLDecoder.decode(request.getParameter("text"), "UTF-8");
This is great for all the special characters I tried, the only thing that makes the problems is "%". Every time I use this character in a string, I get the following exception:
java.lang.IllegalArgumentException: URLDecoder: Incomplete trailing escape (%) pattern
java.net.URLDecoder.decode(URLDecoder.java:187)
at.fhv.students.rotter.ajax.count.CountServlet.doGet(CountServlet.java:31)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
Is this a known bug? Or is it really my mistake?
source
share