【发布时间】:2012-04-05 23:19:20
【问题描述】:
如果在 GET 参数中使用特殊字符(如 Æ、Ø og Å)调用我的 Java Servlet,我会遇到一些问题:http://localhost:8080/WebService/MyService?test=Øst。
我的doGet 中有此代码:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println(request.getParameterValues("test")[0]);
}
控制台打印的消息是:Ã?st。
Web 服务应该能够处理这样的调用。如何正确编码参数值?
【问题讨论】: