Page Encoding
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
For JSP pages, the page encoding is
the character encoding in which the file is encoded.
For JSP pages in standard syntax, the page encoding is
determined from the following sources:
- The page encoding value of a JSP property group (see
Setting Properties for Groups of JSP Pages) whose URL pattern matches the page.
- The
pageEncoding attribute of the
page directive of the page. It is a translation-time error to name different
encodings in the pageEncoding attribute of the page directive
of a JSP page and in a JSP property group.
- The
CHARSET value of the contentType
attribute of the page directive.
If none of these is provided, ISO-8859-1 is used as the default page encoding.
The pageEncoding and contentType
attributes determine the page character encoding of only the file that physically
contains the page directive. A web container raises a
translation-time error if an unsupported page encoding is specified.
Response Encoding
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
The response encoding is the character encoding of the
textual response generated by a web component. The response encoding must be set
appropriately so that the characters are rendered correctly for a given locale.
A web container sets an initial response encoding for a JSP page from the following
sources:
- The
CHARSET value of the contentType
attribute of the page directive
- The encoding specified by the
pageEncoding attribute
of the page directive
- The page encoding value of a JSP property group whose URL pattern matches the page
If none of these is provided, ISO-8859-1 is used as the default response encoding.
J2EE - Character Sets and Encodings
|