uCosminexus Application Server, Web Container Functionality Guide

[Contents][Glossary][Index][Back][Next]

2.6.8 Precautions related to default character encoding

Note the followings regarding the application of default character encoding:

Organization of this subsection
(1) Availability of default character encoding settings for response
(2) Character encoding applied to the getCharacterEncoding method
(3) Character encoding in the XML declaration
(4) Application of character encoding to JSP files
(5) Specifying the character encoding for Web applications that executed JSP pre-compilation with version 07-00
(6) Character encoding for default error pages

(1) Availability of default character encoding settings for response

The default character encoding settings for response are not enabled in the following cases:

#1 Parameter for specifying the static contents extension that applies the default character encoding.

#2 In the case of static contents output after one of the following conditions, the default character encoding settings for response are enabled:
  • When the character encoding is not set for response and when the java.io.PrintWriter object is acquired by the getWriter method of the javax.servlet.ServletResponse interface in the servlet, JSP, or filter.
  • When the request object is wrapped even though the setAttribute method is executed and the request object is wrapped with the request wrapper that does not invoke the setAttribute method.

Note that when the HTTP response compression filter is used, the default character encoding settings for response are not enabled.

(2) Character encoding applied to the getCharacterEncoding method

When the character encoding is not specified in the Servlet specifications, the default character encoding specified for each J2EE server or Web application is applied to the following Servlet API methods:

However, when the character encoding is changed using the setCharacterEncoding method, the same character encoding will be acquired.

For the response, when the reset method of javax.servlet.ServletResponse is used to initialize the response data, the character encoding set in Application Server can be acquired with the getCharacterEncoding method.

For details on the character encoding setting method defined in the Servlet specifications, see 2.6.5 Implementation of default character encoding (For Servlet specifications).

(3) Character encoding in the XML declaration

When the Web container automatically generates an XML declaration in the JSP document and XML tag file, the default character encoding applied to the response body encoding is output in the character encoding declaration in the XML declaration.

(4) Application of character encoding to JSP files

The character encoding settings for JSP files is applied during the compilation of the JSP file. Therefore, if the character encoding settings are added or changed when the JSP file is already compiled, the added or changed character encoding will not be applied to the JSP file. To apply the settings, re-compile the JSP file.

(5) Specifying the character encoding for Web applications that executed JSP pre-compilation with version 07-00

For the Web applications that executed JSP pre-compilation with version 07-00, when you set up the default character encoding for response, re-execute the JSP pre-compilation functionality.

The followings are the description for each of the units to set up the default character encoding:

For details on the default character encoding settings during the JSP pre-compilation, see 2.6.3 Application of character encoding during JSP pre-compilation.

(6) Character encoding for default error pages

The character encoding for default error pages is specified in UTF-8, and therefore the default encoding is not applied.