tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java
Date Wed, 28 Jul 2004 01:04:18 GMT

----- Original Message -----
From: <luehe@apache.org>
To: <jakarta-tomcat-connectors-cvs@apache.org>
Sent: Tuesday, July 27, 2004 5:43 PM
Subject: cvs commit:
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java


> luehe       2004/07/27 17:43:17
>
>   Modified:    coyote/src/java/org/apache/coyote Response.java
>   Log:
>   Fixed Bugtraq 6152759 ("Default charset not included in Content-Type
>   response header if no char encoding was specified").
>
>   According to the Servlet 2.4 spec, calling:
>
>     ServletResponse.setContentType("text/html");
>
>   must yield these results:
>
>     ServletResponse.getContentType() -> "text/html"
>
>     Content-Type response header -> "text/html;charset=ISO-8859-1"
>
>   Notice the absence of a charset in the result of getContentType(), but
>   its presence (set to the default ISO-8859-1) in the Content-Type
>   response header.
>
>   Tomcat is currently not including the default charset in the
>   Content-Type response header if no char encoding was specified.
>

-1.  This gets us right back to the same old problem where we are sending
back "image/gif; charset=iso-8859-1", and nobody can read the response.

If we're not going to assume that the UA believes that the default encoding
is iso-8859-1 (which is what we are doing now), then I'd suggest simply
doing:
   setCharacterEncoding(getCharacterEncoding());
in Response.getWriter (since the spec only requires that we identify the
charset when using a Writer, and we don't really know what it is when using
OutputStream).



Mime
View raw message