Localizing JSP content

JSPs that use a character set other than the server default require additional changes in source code and deployment properties.

In your JSP source code, specify the encoding in the page declaration, for example:

<%@ page contentType="text/html;charset=BIG5" %>

When initializing strings, pass the encoding name to the String constructor, for example:

byte[] b = { (byte)'\u00A4', (byte)'\u00A4',
             (byte)'\u00A4', (byte)'\u00E5' };
String s = new String(b, "big5");

If you do not specify the encoding name, the byte array may be converted incorrectly.

When deploying localized JSPs, group JSPs for each language in their own directory tree under your Web application’s context root. For example, all files under /en are English, 8859_1 encoded and all files under /ko are Korean, KSC5601 encoded. Additionally, configure the following Web application properties:

Property name

Used to specify

com.sybase.jaguar.webapplication.charset.inputparam

Character set for request parameters.

com.sybase.jaguar.webapplication.charset.inputdata

Character set for request body data (retrieved with ServletRequest.getReader or ServletRequest.getInputStream).

com.sybase.jaguar.webapplication.charset.jspcompile

Character set for JSP compilation.

The property values must contain a list of URL-pattern and Java character set name pairs. Use this syntax, where URL_pattern is the url-pattern to which the character set applies, and character_set is the name of the Java character set:

(url-pattern=URL_pattern,charset=character_set),
(url-pattern=URL_pattern,charset=character_set)

For example, for a Web application with two directories, /en and /ko, in its document root where all files under /en are 8859_1 encoded and all files under /ko are KSC5601 encoded, specify the character sets like this:

(url-pattern=/en/*,charset=8859_1),
(url-pattern=/ko/*,charset=KSC5601)

If a URL pattern is not listed, the server’s default character set is used. If you specify a character set that is not supported, it is not added to the mapping and the server’s default character set is used.

NoteThese character set properties are not supported for the default Web application.