|
||
|
|
Appendix D International Content Support
The following information covers the international considerations for general server capabilities:
If you want to enter
UTF-8data on the Server Manager or the Administration Server pages, you need to be aware of the following issues:If a file or directory name is to appear in a URL, it cannot contain 8-bit or multi-byte characters.
To make sure you enter characters in the correct format for users and groups, use a
UTF-8form-capable client (such as Netscape) to input 8-bit or multi-byte data.If you let users access their own user and group information, they will need to use a
UTF-8form-capable client.Using the Accept-language Header
When clients contact a server using HTTP, they can send header information that describes the various languages they accept. You can configure your server to parse this language information as described in Chapter 14 "Content Management."
You can enable or disable the server to the
acceptlanguagedirective in theserver.xmlfile.
Table D-1 International Settings in server.xml
For example, if
acceptlanguageis set toon, and a client sends the Accept-language header with the valuefr-CH,de, when requesting the following URL:http://www.example.com/somepage.html
Your server searches for the file in the following order:
- The
Accept-languagelistfr-CH,de.![]()
http://www.example.com/fr_ch/somepage.html
http://www.example.com/somepage_fr_ch.html
http://www.example.com/de/somepage.html
http://www.example.com/somepage_de.html
- Language codes without the country codes (
frin the case offr-CH):![]()
http://www.example.com/fr/somepage.html
http://www.example.com/somepage_fr.html
- The
DefaultLanguage, such asen, defined in themagnus.conffile.![]()
http://www.example.com/en/somepage.html
http://www.example.com/somepage_en.html
- If none of these are found, the server tries:
![]()
When form data is submitted from a browser to the server using
POST, the browser:
- url-encodes the
POSTdata![]()
- Sets the Content-Type to
application/x-www-form-urlencoded![]()
- Does not send any charset information in the
Content-Typeheader![]()
On the server side, if a servlet tries to access
POSTdata usinggetParameterorgetParameterValues, the servlet container does not have any information about which character encoding to use forgetParameterstrings.You can configure Enterprise Server 6.1 to instruct the servlet container which character encoding to use for interpreting
POSTdata strings. To do this, you would specify the character encodingusing theparameter-encodingelement inweb-apps.xml:<parameter-encoding enc="value"/>
where value can be one of the following:
These values are described below.
autorequires the servlet container to look for some hints regarding the character encoding to be used. The hint can be provided using:
- A request attribute with the name:
com.netscape.server.http.servlet.parameterEncoding. The value is of typeString. The request attribute must be set before any calls togetParameter()orgetParameterValues(). Example:![]()
request.setAttribute("com.netscape.server.http.servlet.
parameterEncoding", "Shift_JIS");
request.getParameter("test");
- This option is used if the servlet knows beforehand what the charset of the posted data is.
- A
j_encodingparameter in the form data. The form that is being submitted can have a hidden element. Example:![]()
<input type=hidden name="j_encoding" value="Shift_JIS" >
- This option is typically used if the servlet that is reading the data does not necessarily know what the charset of the posted data is. The hint parameter name, which by default is
j_encodingcan be changed using theparameter-encodingelement inweb-apps.xml.
Use this option if you wish the platform default encoding to be used for the servlet parameter data.
If none of the above options are specified, the servlet container interprets this string itself as the encoding, so this can be any valid encoding string like
Shift_JIS, orUTF-8. For example, you would specify this asUTF-8if you know that the formPOSTdata is always inUTF-8.
The server will always try to resolve the charset from the
Content-Typeheader of the request first.
For more information on
parameter-encoding, see the Netscape Enterprise Server Programmer's Guide to Servlets.
You can configure
parameter-encodingto work the same way when you are posting to a JSP instead of a servlet. The following example demonstrates a JSP configuration of `auto' to read parameters which are in JapaneseShift_JISencoding:
<%@ page contentType="text/html;charset=Shift_JIS" %><% request.setAttribute("com
<html>
<head>
<title>JSP Test Case</title>
</head>
<body>
.netscape.server.http.servlet.parameterEnc oding", "Shift_JIS");
%>
<h1>The Entered Name is : <%= request.getParameter("test") %> </h1>
</body>
</html>
© 2001 Sun Microsystems, Inc. Portions copyright 1999, 2002 Netscape Communications Corporation. All rights reserved.
Last Updated August 02, 2002