tomcat-users mailing list archives

After some more debugging, here is what we are seeing happen in our Struts
1.1. app. Tomcat 4.0.6 (we also see simular results on 4.1.24, but have not
debugged into it like the below)
a) our request comes into our override of ActionServlet.process() and the
requests
characterEncoding=UTF-8 and the Responses content type = text/html;
charset=UTF-8
just as we want it to be.
b) the request and response maintain their encodings and content-type values
up until RequestProcessor.doForward() is called which then gets a
RequestDispatcher to do the actual forward. (i.e. our action succeeded and
is now forwarding to a success JSP). Since we are using Tomcat the best I
can tell is that the actual RequestDispatcher implementation being executed
and handling this forward is org.apache.catalina.core.ApplicationDispatcher
c) Once ApplicationDispatcher handles the forward and passes the Request and
Response on to the forwarded-to JSP page, we see that the Response object
has its Content-Type reset to text/html; charset=ISO-8859-1, and the
characterEncoding on the response is ISO-8859-1. The request's encoding is
also set back to ISO-8859-1. Why is this?? Shouldn't the Response's encoding
and content-type not be manipulated here?
d) Note, again our JSP page that is forwarded to has <@page
contentType="text/html; charset=UTF-8" %> set at the top of it but this
makes no difference. The UTF-8 data we are trying to display on the JSP page
now has all the question marks (?) in it in place of the special utf-8
chars.
help!!!
----- Original Message -----
From: "aaz" <aaz@interoperate.com>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Wednesday, September 10, 2003 12:59 PM
Subject: Re: content type charset
> Yeah we have response.setContentType("text/html; charset=UTF-8") in our
> ActionServlet.process() override (which iis called before anything is
> printed to the browser)
>
> Anyone else have some tips? Is there a server.xml config setting for this?
>
> ----- Original Message -----
> From: "Mark Orr" <mark@markorr.net>
> To: "'Tomcat Users List'" <tomcat-user@jakarta.apache.org>
> Sent: Wednesday, September 10, 2003 12:16 PM
> Subject: RE: content type charset
>
>
> > Hi,
> >
> > This might not be the cause of your problem, but it caught
> > me out recently until I read the Javadoc for the setContentType
> > method of ServletResponse:
> >
> > "If obtaining a PrintWriter, this method should be called first."
> >
> > In otherwords, set your response type first, then get your
> > PrintWriter, not the other way around.
> >
> > Mark
> >
> > -----Original Message-----
> > From: aaz [mailto:aaz@interoperate.com]
> > Sent: 10 September 2003 17:22
> > To: tomcat-user@jakarta.apache.org
> > Subject: content type charset
> >
> >
> > Hi,
> > We are using Tomcat 4.1.24 and jdk 1.4.1. And are having problems
getting
> > the HTTP headers returned from Tomcat to return the correct charset we
> need
> > to display our utf-8 encoded database data. (right now our text has all
> the
> > ? chars in it in place of the special chars)
> >
> > We need tomcat to start returning
> > Content-Type: text/hml; charset=UTF-8
> >
> > no matter what, tomcat keeps returning the http header
> > Content-Type: text/hml; charset=ISO-8859-1 and calls to
> > response.getCharacterEncoding() keeps returning ISO-8859-1 rather than
> UTF-8
> >
> > All of our JSP pages have:
> > <@page contentType="text/html; charset=UTF-8" %> and <DEFANGED_meta
> > http-equiv="Content-Type" content="text/html; charset=UTF-8">
> >
> > We are using Struts 1.1. and override ActionServlet.process and have the
> > following line of code as well placed there:
> > response.setContentType("text/html; charset=UTF-8");
> >
> > In our catalina.bat we have JAVA_OPTS set = -Dfile.encoding=UTF-8
> >
> > What gives? Help please!
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>