From: Adam A. <ro...@gm...> - 2009-01-08 20:50:32
|
I'm having an encoding issue after upgrading from Jetty 6.1.11 to Jetty 6.1.14. Text data submitted via POST no longer gets interpretted as UTF-8. If I post "Héy." the request object gives me "HÃ(c)y." in the resultant Java string. I get the same problem with Jetty 6.1.12. Reverting to Jetty 6.1.11 fixes the problem. I tried adding "-Dorg.mortbay.util.URI.charset=utf-8" to my VM parameters with no luck. I intercepted the HTTP request with Fiddler2 (MS proxy), and the correct bytes are encoded in the request. (Fiddler2 also correctly identifies the post data as "Héy.") Also, explicitly setting the enctype and the accept-charset attributes on the Form didn't help. I've included a simplified version of the web page and the controller code below. Does anyone have any suggestions? Is this a bug in Jetty or a configuration issue? Web page: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Submission to check encoding</title><meta content="text/html; Charset=utf-8" http-equiv="content-type" /> </head><body> <form method="post" action="/www.einvite.com-6.0-SNAPSHOT/email/wording" id="theForm"> <textarea name="testText" id="group1" rows="3" cols="40">Héy.</textarea> <input name="textSubmit" id="textSubmit" value="Submit Text" type="submit" /> </form> </body> </html> Controller method: (Spring 2.5 gives the request object to the method): @RequestMapping(value = "/texttest", method = RequestMethod.POST) public String postTestText(final HttpServletRequest request) { final String testText = request.getParameter("testText"); System.out.println("Text text: " + testText); return "testText"; } |