You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Remy Maucherat <re...@apache.org> on 2003/11/11 16:10:24 UTC

[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.

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


Re: [5.0] content-type and charset issues

Posted by Stefanos Karasavvidis <st...@msc.gr>.

<meta http-equiv="Content-Type" content="text/html; charset=windows-1253">
Remy Maucherat wrote:

> Kazuhiro Kazama wrote:
> 
>> Remy,
>>
>>> 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.
>>
>>
>> I received the report that the same(?) charset problem exists in
>> Tomcat 4.1.29 from Japanese developers. They said that Tomcat 4.1.27
>> is ok.
>>
>> Could you check whether the same problem exists or not?
>>
>> If not, I will analyze Tomcat 4.1.29 and send the patch.
> 
> 
> This has been fixed already. However, I have to point out that the 
> client is not compliant (not specifying a charset is equivalent to 
> specifying charset=ISO-8859-1).
> 
> Remy

This might be true, but there is the "meta http-equiv" tag in HTML
that does not work as expected when setting the encoding in the HTTP 
response. If both HTTP encoding and "meta" HTML encoding are specified, 
the HTTP encoding takes precedence (according to section 5.2.2 of HTML 
4.01 spec) and the users still need to manually set the encoding from 
the user-agents interface.

For example, imagine having a set of html files served by tomcat, which 
all are encoded with non iso-8859-1 encoding. Even if all of them have a 
meta tag with the correct encoding, tomcat adds by default the 
iso-8859-1 to the HTTP response. The user seens "grabage".

Please note that Apache server does the same in a default installation 
but this is simply unacceptable in a "multi-encoding" installation. I 
have to remove the relevant directive from the httpd.conf file in all 
apache installations because my users are not able to write non 
iso-8859-1 html files.

Please also note from section 5.2.2 of HTML 4.01
"The HTTP protocol ([RFC2616], section 3.7.1) mentions ISO-8859-1 as a 
default character encoding when the "charset" parameter is absent from 
the "Content-Type" header field. In practice, this recommendation has 
proved useless because some servers don't allow a "charset" parameter to 
be sent, and others may not be configured to send the parameter. 
Therefore, user agents must not assume any default value for the 
"charset" parameter."

I would add to this, that servers simply setting a character encoding by 
defualt to ALL responses is at least as bad as not setting at all.

Stefanos Karasavvidis



-- 
======================================================================
Stefanos Karasavvidis
Electronic & Computer Engineer
e-mail : stefos@msc.gr

Multimedia Systems Center S.A.
Kissamou 178
73100 Chania - Crete - Hellas
http://www.msc.gr

Tel : +30 2821 0 88447
Fax : +30 2821 0 88427

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [5.0] content-type and charset issues

Posted by Remy Maucherat <re...@apache.org>.
Kazuhiro Kazama wrote:
> Remy,
> 
>>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.
> 
> I received the report that the same(?) charset problem exists in
> Tomcat 4.1.29 from Japanese developers. They said that Tomcat 4.1.27
> is ok.
> 
> Could you check whether the same problem exists or not?
> 
> If not, I will analyze Tomcat 4.1.29 and send the patch.

This has been fixed already. However, I have to point out that the 
client is not compliant (not specifying a charset is equivalent to 
specifying charset=ISO-8859-1).

Remy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [5.0] content-type and charset issues

Posted by Kazuhiro Kazama <ka...@ingrid.org>.
Remy,

From: Remy Maucherat <re...@apache.org>
Subject: [5.0] content-type and charset issues
Date: Tue, 11 Nov 2003 16:10:24 +0100
Message-ID: <3F...@apache.org>
> 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.

I received the report that the same(?) charset problem exists in
Tomcat 4.1.29 from Japanese developers. They said that Tomcat 4.1.27
is ok.

Could you check whether the same problem exists or not?

If not, I will analyze Tomcat 4.1.29 and send the patch.

Kazuhiro Kazama (kazama@ingrid.org)	NTT Network Innovation Laboratories


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [5.0] Getting some defaults from system properties

Posted by Glenn Nielsen <gl...@mail.more.net>.
Oops, I misread your reply. :-)

Glenn

Remy Maucherat wrote:
> Glenn Nielsen wrote:
> 
>> Remy Maucherat wrote:
>>
>>> Glenn Nielsen wrote:
>>>
>>>> Couldn't these be set using the DefaultContext?
>>>
>>>
>>> Why not ?
>>> It seems like a better fit.
>>
>>
>> In what way?
> 

----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [5.0] Getting some defaults from system properties

Posted by Remy Maucherat <re...@apache.org>.
Glenn Nielsen wrote:
> Remy Maucherat wrote:
> 
>> Glenn Nielsen wrote:
>>
>>> Couldn't these be set using the DefaultContext?
>>
>> Why not ?
>> It seems like a better fit.
> 
> In what way?

Your way.

Remy


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [5.0] Getting some defaults from system properties

Posted by Glenn Nielsen <gl...@mail.more.net>.

Remy Maucherat wrote:
> Glenn Nielsen wrote:
> 
>> Couldn't these be set using the DefaultContext?
> 
> 
> Why not ?
> It seems like a better fit.
> 

In what way?

Having one method to configure defaults for Context's seems better
than having multiple methods. And keeping the configuration of these
in server.xml keeps everything consistent.

Regards,

Glenn

----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [5.0] Getting some defaults from system properties

Posted by Remy Maucherat <re...@apache.org>.
Glenn Nielsen wrote:
> Couldn't these be set using the DefaultContext?

Why not ?
It seems like a better fit.

Remy



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [5.0] Getting some defaults from system properties

Posted by Glenn Nielsen <gl...@mail.more.net>.
Couldn't these be set using the DefaultContext?

Regards,

Glenn

Remy Maucherat wrote:
> Hi,
> 
> This is a little similar to the Ant-like properties for server.xml.
> 
> The problem: the allowLinking and caseSensitivity flags of 
> FileDirContext, which can be set per context using the Resources 
> element, but it's kind of annoying to do it server wide.
> 
> All defaults for flags (and others) are hardcoded, which is logical. 
> However, for some, it would be convinient to be able to set them in a 
> global way.
> 
> For the naming conventions for the property names, I plan to use:
> fully_qualified_class_name.field_name
> 
> The algorithm is the following for a field:
> - look up the appropriate system property
> - if defined, use it
> - otherwise, use the old defaults
> 
> I don't think that many fields would be defaulted using this.
> 
> Additionally, to allow easily setting system properties, all the 
> properties from catalina.properties will be set as system properties. 
> Since catalina.properties is not used in embedded mode (it is loaded 
> only by Bootstrap), there should be zero impact for this use case.
> 
> Comments ?
> 
> Remy
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


[5.0] Getting some defaults from system properties

Posted by Remy Maucherat <re...@apache.org>.
Hi,

This is a little similar to the Ant-like properties for server.xml.

The problem: the allowLinking and caseSensitivity flags of 
FileDirContext, which can be set per context using the Resources 
element, but it's kind of annoying to do it server wide.

All defaults for flags (and others) are hardcoded, which is logical. 
However, for some, it would be convinient to be able to set them in a 
global way.

For the naming conventions for the property names, I plan to use:
fully_qualified_class_name.field_name

The algorithm is the following for a field:
- look up the appropriate system property
- if defined, use it
- otherwise, use the old defaults

I don't think that many fields would be defaulted using this.

Additionally, to allow easily setting system properties, all the 
properties from catalina.properties will be set as system properties. 
Since catalina.properties is not used in embedded mode (it is loaded 
only by Bootstrap), there should be zero impact for this use case.

Comments ?

Remy



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [VOTE] Kurt Miller as commiter

Posted by Filip Hanik <de...@hanik.com>.
[+1], yes more people on jk2
----- Original Message -----
From: "Kurt Miller" <tr...@optonline.net>
To: "Tomcat Developers List" <to...@jakarta.apache.org>
Sent: Thursday, November 13, 2003 4:30 AM
Subject: Re: [VOTE] Kurt Miller as commiter


From: "Henri Gomez" <hg...@apache.org>
> jean-frederic clere a écrit :
>
> > Henri Gomez wrote:
> >
> >> Hi to all,
> >>
> >> I would like to propose you a new tomcat commiter, Kurt Miller
> >> which as proposed many usefull patches for JK2
> >>
> >> Since we want to deprecated jk and focus jk2, we need
> >> more people involved on jk2.
> >>
> >> Vote please.
>
> Ok, it seems that nobody object to this vote, so we should consider
> that Kurt is a new tomcat commiter.
>
> Welcome on board.
>

I'm quite glad to be hear. :-) Thanks for all the positive votes and
comments.

Initially, I plan to continue to refine the jk2 native build process.
Building a DSO for apache13 is in good shape now so I'll be looking at other
areas next.

-Kurt


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [VOTE] Kurt Miller as commiter

Posted by Kurt Miller <tr...@optonline.net>.
From: "Henri Gomez" <hg...@apache.org>
> jean-frederic clere a écrit :
>
> > Henri Gomez wrote:
> >
> >> Hi to all,
> >>
> >> I would like to propose you a new tomcat commiter, Kurt Miller
> >> which as proposed many usefull patches for JK2
> >>
> >> Since we want to deprecated jk and focus jk2, we need
> >> more people involved on jk2.
> >>
> >> Vote please.
>
> Ok, it seems that nobody object to this vote, so we should consider
> that Kurt is a new tomcat commiter.
>
> Welcome on board.
>

I'm quite glad to be hear. :-) Thanks for all the positive votes and
comments.

Initially, I plan to continue to refine the jk2 native build process.
Building a DSO for apache13 is in good shape now so I'll be looking at other
areas next.

-Kurt


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [VOTE] Kurt Miller as commiter

Posted by Henri Gomez <hg...@apache.org>.
jean-frederic clere a écrit :

> Henri Gomez wrote:
> 
>> Hi to all,
>>
>> I would like to propose you a new tomcat commiter, Kurt Miller
>> which as proposed many usefull patches for JK2
>>
>> Since we want to deprecated jk and focus jk2, we need
>> more people involved on jk2.
>>
>> Vote please.

Ok, it seems that nobody object to this vote, so we should consider
that Kurt is a new tomcat commiter.

Welcome on board.





---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [VOTE] Kurt Miller as commiter

Posted by jean-frederic clere <jf...@fujitsu-siemens.com>.
Henri Gomez wrote:
> Hi to all,
> 
> I would like to propose you a new tomcat commiter, Kurt Miller
> which as proposed many usefull patches for JK2
> 
> Since we want to deprecated jk and focus jk2, we need
> more people involved on jk2.
> 
> Vote please.

+1

> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [VOTE] Kurt Miller as commiter

Posted by Jean-Francois Arcand <jf...@apache.org>.
+1

-- Jeanfrancois

Henri Gomez wrote:

> Hi to all,
>
> I would like to propose you a new tomcat commiter, Kurt Miller
> which as proposed many usefull patches for JK2.
>
> Since we want to deprecated jk and focus jk2, we need
> more people involved on jk2.
>
> Vote please.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [VOTE] Kurt Miller as commiter

Posted by Remy Maucherat <re...@apache.org>.
Henri Gomez wrote:
> Hi to all,
> 
> I would like to propose you a new tomcat commiter, Kurt Miller
> which as proposed many usefull patches for JK2.
> 
> Since we want to deprecated jk and focus jk2, we need
> more people involved on jk2.
> 
> Vote please.

+1

Rémy



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


RE: [VOTE] Kurt Miller as commiter

Posted by Mladen Turk <mt...@apache.org>.
+1

MT. 

-----Original Message-----
From: Henri Gomez [mailto:hgomez@apache.org] 
Sent: 11. studeni 2003 16:27
To: Tomcat Developers List
Subject: [VOTE] Kurt Miller as commiter

Hi to all,

I would like to propose you a new tomcat commiter, Kurt Miller which as
proposed many usefull patches for JK2.

Since we want to deprecated jk and focus jk2, we need more people involved
on jk2.

Vote please.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [VOTE] Kurt Miller as commiter

Posted by Tim Funk <fu...@joedog.org>.
+1 (Yeah .. more jk2 committers!)

-Tim

Henri Gomez wrote:

> Hi to all,
> 
> I would like to propose you a new tomcat commiter, Kurt Miller
> which as proposed many usefull patches for JK2.
> 
> Since we want to deprecated jk and focus jk2, we need
> more people involved on jk2.
> 
> Vote please.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [VOTE] Kurt Miller as commiter

Posted by Glenn Nielsen <gl...@mail.more.net>.
+1, Glad to have you aboard.

Henri Gomez wrote:
> Hi to all,
> 
> I would like to propose you a new tomcat commiter, Kurt Miller
> which as proposed many usefull patches for JK2.
> 
> Since we want to deprecated jk and focus jk2, we need
> more people involved on jk2.
> 
> Vote please.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 


-- 
----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


[VOTE] Kurt Miller as commiter

Posted by Henri Gomez <hg...@apache.org>.
Hi to all,

I would like to propose you a new tomcat commiter, Kurt Miller
which as proposed many usefull patches for JK2.

Since we want to deprecated jk and focus jk2, we need
more people involved on jk2.

Vote please.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [5.0] content-type and charset issues

Posted by Remy Maucherat <re...@apache.org>.
Remy Maucherat wrote:

> 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.
> 
> Other than that, 5.0.14 looks quite good :)

I have fixed it, but the patch which caused it is not very optimal, as 
it uses String concatenations. IMO, if the user sets the full String 
(including the charset) using setContentType, then we should probably 
use it rather than reconstruct it again.

I'll do a performance analysis to make sure there are no regressions 
(after all, similar problems could have been introduced).

Rémy



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


[5.0.15] New tag soon (probably)

Posted by Remy Maucherat <re...@apache.org>.
Hi,

As was discussed earlier, I'll put in a new tag when the final 
specifications are available.

There may not be a need for a new beta release since:
- 5.0.14 has been rather successful
- an extra beta testing month has been added
- the CVS code has been rather stable for a while
Of course, this will be up to the vote results :)

Rémy



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [5.0] content-type and charset issues

Posted by Remy Maucherat <re...@apache.org>.
Bill Barker wrote:
>>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.

If the charset is iso-latin-1, then it will be displayed.

The startsWith could possibly be going too far, unless this is written 
in black and white in the HTTP spec (I didn't check).
I think my patch restored the previous behavior (and saved some object 
allocation in the general case). People seemed to be fine with it, 
unlike the new behavior (for which I've seen complaints on tomcat-user).

Remy



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: [5.0] content-type and charset issues

Posted by Bill Barker <wb...@wilshire.com>.
----- Original Message -----
From: "Remy Maucherat" <re...@apache.org>
To: "Tomcat Developers List" <to...@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
>