uCosminexus Application Server, Web Container Functionality Guide

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

2.6.5 Implementation of default character encoding (For Servlet specifications)

In the locations where the character encoding settings defined in the Servlet specifications exist, the default character encoding set up on Application Server is disabled.

This subsection describes the character encoding settings defined in the Servlet specifications. Note that the character encoding settings depend on the version of the Servlet specifications.

Organization of this subsection
(1) Character encoding setting method defined in the Servlet specifications
(2) Character encoding defined in the Servlet specifications

(1) Character encoding setting method defined in the Servlet specifications

The following table describes the character encoding setting method defined in the Servlet specifications for each Servlet/JSP version:

Table 2-20 Character encoding setting method defined in the Servlet specifications (Servlet 2.5, 3.0/JSP 2.1)

Setting contents Setting location Setting method in the Servlet specifications
Character encoding of request Servlet ServletRequest.setCharacterEncoding(java.lang.String env)#1
JSP files None
Character encoding of response Servlet
  • ServletResponse.setCharacterEncoding(java.lang.String charset)#1
  • ServletResponse.setContentType(java.lang.String type)#1
  • ServletResponse.setLocale(java.util.Locale loc)#1
JSP files
  • contentType attribute value of the Page directive (including charset)#2
  • pageEncoding attribute of the Page directive#3
  • page-encoding element of web.xml#2
Character encoding of JSP file JSP files
  • BOM#3
  • contentType attribute value of the Page directive (including charset)#2
  • pageEncoding attribute of the Page directive or Tag directive#3
  • page-encoding element of web.xml#2
  • encoding attribute of the XML declaration#4

#1
Package is javax.servlet.

#2
Method set up in the JSP page.

#3
Method set up in the JSP page or in the standard format tag file.

#4
Method set up in the JSP document or XML tag file.

Table 2-21 Character encoding setting method defined in the Servlet specifications (Servlet 2.4/JSP 2.0)

Setting contents Setting location Setting method in the Servlet specifications
Character encoding of request Servlet ServletRequest.setCharacterEncoding(java.lang.String env)#1
JSP files None
Character encoding of response Servlet
  • ServletResponse.setCharacterEncoding(java.lang.String charset)#1
  • ServletResponse.setContentType(java.lang.String type)#1
  • ServletResponse.setLocale(java.util.Locale loc)#1
JSP files
  • contentType attribute value of the Page directive (including charset)#2
  • pageEncoding attribute of the Page directive#3
  • page-encoding element of web.xml#2
Character encoding of JSP file JSP files
  • contentType attribute value of the Page directive (including charset)#2
  • pageEncoding attribute of the Page directive or Tag directive#3
  • page-encoding element of web.xml#2
  • encoding attribute of the XML declaration#4

#1
Package is javax.servlet.

#2
Method set up in the JSP page.

#3
Method set up in the JSP page or in the standard format tag file.

#4
Method set up in the JSP document or XML tag file.

Table 2-22 Character encoding setting method defined in the Servlet specifications (Servlet 2.3/JSP 1.2)

Setting contents Setting location Setting method in the Servlet specifications
Character encoding of request Servlet ServletRequest.setCharacterEncoding(java.lang.String env)#1
JSP files None
Character encoding of response Servlet
  • ServletResponse.setContentType(java.lang.String type)#1
  • ServletResponse.setLocale(java.util.Locale loc)#1
JSP files contentType attribute value of the Page directive (including charset)
Character encoding of JSP file JSP files
  • contentType attribute value of the Page directive (including charset)#2
  • pageEncoding attribute of the Page directive#2

#1
Package is javax.servlet.

#2
Method set up in the JSP page or JSP document.

(2) Character encoding defined in the Servlet specifications

If the character encoding settings in the Servlet specifications and the default character encoding settings in Application Server do not exist, the character encoding defined in the Servlet specifications is applied.

When the character encoding is not specified, the following character encoding that are defined in the Servlet specifications will be applied: