Encoding is used for character conversion on the output stream. It is written to the charset
field of the contentType
HTTP response header, and it is part of the XML declaration at the head of the serialized output. Encoding can be explicitly set in the stylesheet through the encoding
attribute: <xsl:output encoding="x"/>
. If none is provided, the ATG platform checks the contentType
property of the DynamoHTTPServletResponse
component to see if it was already set by a JSP. If it is null, the ATG platform uses the default encoding specified for the active locale—for example, iso
8859
1
for English.
It is generally desirable that the encoding type for the XML file match the encoding used by the JSP that embeds it, depending on the contents of both files. If the JSP renders text, the XML in it might be unreadable if it uses a different character set. In this case, you might want to set encoding in both <xsl:output>
and the JSP that uses the servlet bean, or not set it in either place so both use the default encoding.
You can set encoding for a JSP by invoking the setContentType
method either in the page directly so it applies to the proceeding contents in the page or in the page directive:
<%@ page contentType="text/html; charset=iso
10646
1"%>
For more information, see InternationalizingaDynamoWebSite in the ATG Programming Guide.