tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Orr" <>
Subject RE: content type charset
Date Wed, 10 Sep 2003 18:16:46 GMT

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.


-----Original Message-----
From: aaz [] 
Sent: 10 September 2003 17:22
Subject: content type charset

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 <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!

View raw message