分类: LINUX
2006-11-28 18:19:45
from
JSP is Java, so the web container uses Unicode internally, but the JSP page is typically stored using another encoding, and the response may need to be sent to the browser with different encoding still. There are two page directive attributes that can specify these charsets. The pageEncoding attribute specifies the charset for the bytes in the JSP page itself, so the container can translate them to Unicode when it reads the file. The contentType attribute can contain a charset in addition to the MIME type, as shown in Figure 13-4. This charset tells the container to convert the Unicode characters used internally to the specified charset encoding when the response is sent to the browser. It is also used to set the charset attribute in the Content-Type header to tell the browser how to interpret the response. If a pageEncoding is not specified, the charset specified by the contentType attribute is used to interpret the JSP page bytes as well, and vice versa if pageEncoding is specified but not a contentType charset. If a charset is not specified at all, ISO-8859-1 is used for both the page and the response.1
这里有几处涉及到编码:
JSP Page Source
Response (sent from web container to web browser)
web Container 内部