tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: [5.0] content-type and charset issues
Date Tue, 11 Nov 2003 21:36:36 GMT

----- Original Message -----
From: "Remy Maucherat" <remm@apache.org>
To: "Tomcat Developers List" <tomcat-dev@jakarta.apache.org>
Sent: Tuesday, November 11, 2003 7:10 AM
Subject: [5.0] content-type and charset issues


> Hi,
>
> Tomcat 5.0 always adds a charset=ISO-8859-1 to the content type. While
> this is I think relatively legal, it is rather risky (it causes problems
> with some clients, as I've read on tomcat-user), and very dubious when
> dealing with non text data.
>
> Example:
> GET /tomcat.gif HTTP/1.0
> User-Agent: ApacheBench/1.3d
> Host: 127.0.0.1
> Accept: */*
>
> HTTP/1.1 200 OK
> ETag: W/"1934-1068549702000"
> Last-Modified: Tue, 11 Nov 2003 11:21:42 GMT
> Content-Type: image/gif;charset=ISO-8859-1
> Content-Length: 1934
> Date: Tue, 11 Nov 2003 14:59:56 GMT
> Server: Apache-Coyote/1.1
> Connection: close
>
> (lol)
>
> Maybe Jan's changes to charset handling caused that.
> If charset is not explicitely added, I think it should not be added to
> content-type either.
>

What about adding the charset only when contentType.startsWith("text")?  A
better choice would be when usingWriter is true, but that's not available
here.

Since Writer output is sent out as iso-latin-1 if the Servlet doen't set the
charset, I think that it would be better to add the charset to the header,
rather than trust that the browser's default encoding is compatible.

> Other than that, 5.0.14 looks quite good :)
>
> Rémy
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>


Mime
View raw message