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); }

Advertisement

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.

Join 81 other followers