HttpServletRequest.getParameter encoding

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

HttpServletRequest.getParameter encoding

Leon Torres-2
Hey folks, recently I found a bug where inputting unicode would break some
servlet code that uses HttpServletRequest.getParameter() directly.

The fix was as follows,

accountName = new
String(request.getParameter("accountName").getBytes("iso-8859-1"), "UTF-8");

I was wondering if there was some OFBiz way of doing this, perhaps in UtilHttp,
that doesn't have the overhead of scanning and transforming all the parameter
values.  Anyone know?

- Leon