tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allen,Eva" <>
Subject How to get Tomcat to send proper charset?
Date Wed, 13 Jun 2007 03:35:59 GMT
We just recently switched our platform from tomcat 4.124 to Tomcat
5.5.23 and now languages Japanese, Chinese (traditional) and Chinese
(simplified) are not displaying properly.   Here's a little background.

We use servlets to build HTML code to be output (please no comments on
how bad an idea this is; it's legacy code, we must support it).  What
we'd done up until now is determine the language to be used from the
login page, save it in the session and use it to determine what
character set should be output.  The character set was explicitly stated
in a meta header on the output web page like so

<html lang=ja>
<title>Page Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<html lang=en>
<title>Page Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

That is no longer working.  It was suggested that tomcat was paying
attention to the HTTP Content-Type header to determine what character
set to display so I modified the code a little bit to use

response.setContentType("text/html; charset="UTF-8")
response.setContentType("text/html; charset="iso-8859-1")

depending on which was appropriate.

But even though that response header is explicitly set in the code,
somehow, somewhere it's changed again, because I've determined that the
content type response header looks like this:

 Content-Type: text/html;charset=ISO-8859-1

What's going on?  Why is Tomcat ignoring what we're telling it?  How can
we get Tomcat to send the correct response header so that our Japanese
and Chinese readers can see something other than gibberish?
Eva Allen
Consulting Software Engineer, OCLC, Inc.
6565 Kilgour Pl., Dublin, OH  43017
614.764.6009 |
Views contained herein are my own; they do not necessarily reflect those
of my employer

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message