GET urls are latin-1 encoded.

12 01 2007

Looks like get urls are latin-1 encoded.

Wrapping the request and recoding looks like it works.

protected void doGet(final HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // GET doesnt do UTF-8 encoding even URL, take the default encoding of the machine HttpServletRequestWrapper httprequest = new HttpServletRequestWrapper(request) { @Override public String getParameter(String name) { String param = request.getParameter(name); try { return new String(param.getBytes(“ISO-8859-1″),”UTF-8”); } catch (UnsupportedEncodingException e) { return param; } } }; execute(httprequest, response); }

Advertisements

Actions

Information




%d bloggers like this: