我的Java的URLDecoder有问题.我在JavaScript中转义String,并将其发送到java servlet.然后我使用以下行解码转义的String:
URLDecoder.decode(request.getParameter("text"), "UTF-8");
Run Code Online (Sandbox Code Playgroud)
这适用于我尝试的每个特殊字符,唯一出现问题的是'%'.每次我在字符串中使用此字符时,都会出现以下异常:
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)
Run Code Online (Sandbox Code Playgroud)
这是一个已知的错误?还是我的错?