|
| Problem | In order to pass Japanese and other UTF8 characters to a servlet via a HTTP request (GET or POST), you must set a JVM parameter within the WebSphere Application Server: -Ddefault.client.encoding=<encoding type> | | | | Solution | Customer Problem:
Application sends Japanese data with a POST or GET to a servlet. The servlet retrieves the values of the parameters using either HttpUtils.parseQueryString() or HttpServletRequest.getParameter(). In both cases the data is not returned as Japanese, but an empty string or a series of '?' characters.
There are cases where Japanese data is sent to the server in the HTTP body. In these cases, the data is read from the HttpServletRequest input stream based on the content encoding sent by the browser (such as, Content-Type ... charset=UTF8). When the encoding is set to read Japanese from the input stream, all the Japanese data is returned correctly.
Solution:
By using the JVM parameter -Ddefault.client.encoding=UTF8
for the Application Server, Japanese characters are processed correctly. In WebSphere Application Server V4.0.x, this parameter's name has been changed to "client.encoding.override". These two parameters only apply to REQUEST headers, not to RESPONSE headers. RESPONSE headers must be defined in code for servlets or via the JSP "file.encoding" parameter. To add the JVM parameter to WebSphere Application Server V3.5.X- Open the adminclient
- Navigate to the appserver and select it
- In the "Command line Arguments" field enter:
-Ddefault.client.encoding=UTF8 - Choose "OK"
- Choose "apply"
- Restart the appserver
To add the JVM parameter to WebSphere Application Server V4.0.X- Open up the adminclient
- Navigate to the appserver and select it
- Click on the "JVM Settings" tab
- Click on the "Advanced JVM Settings" button
- In the "Command line arguments" field enter:
-Dclient.encoding.override=UTF8 - Choose "OK"
- Choose "apply"
- Restart the appserver
| |
| |
| |
|
Product categories: Software, Application Servers, Distributed Application & Web Servers, WebSphere Application Server, Servlet Engine/Web Container Operating system(s): Multi-Platform Software version: 3.5, 4.0 Software edition: Standard, Advanced Reference #: 1008783 IBM Group: Software Group Modified date: 2004-03-15
(C) Copyright IBM Corporation 2000, 2004. All Rights Reserved.
|