I have a servelt which reads parameters from a < form > , using HttpServletRequest.getParameter(). The catch is, parameters data (filled in by the user) is in Chinese.
I noticed that even though my page encoding is "unicode", the browser (IE6) seems to send the parameters in utf-8 (I'm not sure whether it's part of the HTTP spec, or is it and IE6 thing.... ?).
Unfortunately, Tomcat's implementation for HttpServletRequest.getParameter() returns garbage, because it does *not* assume that parameters are encoded in utf-8 (it seems to assume "latin1", or something very similar). I did manage to forcefully convert the data, using the following ugly code:
I was wondering, is there a nicer way to do it ? E.g. is there some tomcat configuration file, where you can tell it the request.getParameter() should parse the data assuming the browser sent it using utf-8 ?