We are currently developing a web application that is accessible from a number of countries. The application comprises a number of forms and work fine, except when they are used from some eastern european countries, that uses a different character set.
- Posted by: Patrick van Leuveren
- Posted on: November 15 2002 08:39 EST
The requests we receive are encoded as UTF-8 in these cases. Users from other countries use other encodings and they work fine. If the english language is added to the client's browser, it also works fine. But this is not considered to be an acceptable solution.
When the request is encoded as UTF-8, calling request.getParameter() returns illegal values. The result is trimmed at the first non regular character.
We tried the following:
- setting accept-charsets on the table;
- String val = new String ( request.getParameter("..").getBytes( "ISO8859_1"), `actual encoding used`)
But neither of these approaches works.
The application is hosted on WebSphere 3.5 (on AIX) and seems to have worked fine under the same circumstances on oracle.
Has anyone dealt with this before and can you supply us suggestions or even better, a working solution?
Thanks in advance,
- i18n vs WebSphere; processing forms in diff. character encodings by James Burton on November 15 2002 12:04 EST
- i18n vs WebSphere; processing forms in diff. character encodings by Dmitry Namiot on November 17 2002 05:05 EST
Why allow the client to use anything but UTF-8 in the first place? All modern browsers support it, including in Central Europe.
String ans=new String (request.getParameter("your_param").getBytes(inputEncoding==null?"ISO-8859-1":inputEncoding),"your_target_encoding");