If your JSP page is being included from another servlet, then it won't be 
allowed to set the content-type (or charset) of the response.  Just a wild 
guess here :).

The HTTP/1.1 RFC states that the character encoding of the headers is 
iso-8859-1.  That is why Tomcat doesn't provide an option to change it.

"ruphus13" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi - I'm trying to show utf-8 data in the browser from my jsp page.
> When the page renders, its character encoding is iso-8859-1, according
> to the browser.  The http
> response headers have the same encoding (iso-8859-1).
>
> Here's what's been done thus far:
>
> 1) meta tag set as follows:
> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
>
> 2) jsp page encoding directive issued at the start of the jsp page.
> <[EMAIL PROTECTED] contentType="text/html; charset=UTF-8"%>
>
> 3) Generated jsp page has the following java code, as a consequence:
> try {
>     _jspxFactory = JspFactory.getDefaultFactory();
>     response.setContentType("text/html; charset=UTF-8");
>     pageContext = _jspxFactory.getPageContext(this, request, response,
>               null, false, 8192, true);
>     application = pageContext.getServletContext();
>     config = pageContext.getServletConfig();
>     out = pageContext.getOut();
>     _jspx_out = out;
> ...
> 4) When I save the page as an html file and open it as an html file in
> the browser, it renders correctly (due to the meta tag and no http
> headers), which is expected.
>
> 5) Manually changing the page encoding in firefox results in the page
> being rendered correctly.
>
> 6) Also set utf-8 in the connector settings in tomcat/conf/server.xml
> (for GETs?)
>
> <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
>              port="8080" minProcessors="5" maxProcessors="75"
>              URIEncoding="UTF-8" useBodyEncodingForURI="true"
>              enableLookups="true" redirectPort="8443"
>              acceptCount="100" debug="0" connectionTimeout="20000"
>              useURIValidationHack="false" disableUploadTimeout="true" />
>
> 7) Set utf-8 in web.xml as follows:
> <servlet>
>       <servlet-name>jsp</servlet-name>
>       <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
>       <init-param>
>           <param-name>javaEncoding</param-name>
>           <param-value>UTF8</param-value>
>       </init-param>
> ...
>
> However, the page still shows up as iso-8859-1 (in firefox and IE),
> and viewing the response headers using a 3rd party plugin shows the
> content-type as ISO-8859-1
>
> Tomcat: 4.1.31
> JDK: 1.4.2
>
> What I'm hoping to learn is how to set the http response headers
> correctly.  It seems that the generated java code is doing the right
> thing.  However, the response header is still jacked...
>
> Any help will be very, very much appreciated!  I've gone through
> several articles on Goog as well as the tomcat mailing list... The
> brick wall is getting bloodier, and I'm getting woozy from the
> pounding...
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> 




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to