DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30404>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30404

default charset for conten-type header

           Summary: default charset for conten-type header
           Product: Tomcat 4
           Version: 4.1.29
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Connector:Coyote HTTP/1.1
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Hello,

In our web-app that runs with Tomcat 4.1.29 we set the content-type 
to "text/xml" in a servlet that serves an XML file. The XML encoding normally 
is UTF-8. We observed that special characters show up wrong in the browser. 
Packet sniffing showed that Tomcat changed the content-type 
to "text/xml;charset=ISO-8859-1" which was not the case with 
earlier Tomcat versions.

I looked up the bug database and the mailing list for this behaviour and read 
that Tomcat does this for alle "text/*" content types where the charset is 
mising.

To fix this I can change the mime-type-definition in web.xml to 
"text/xml;charset=UTF-8" or add this in my servlet. But If my servlet has to 
serve ISO-8859-1 XML files that would be also wrong. Should I parse the 
resource prior to serving it in order to determine the encoding?

I cannot find the strong requirement to add the default charset in the HTTP 
spec. I read a discussion in the list that the JSP spec requires it - but also 
for a servlet? 
I think the charset is added by the Coyote connector so from the connector's 
point of view servlets and JSP-servlets are the same.

Doesn't it make sense to omit the default charset for XML files because XML 
files normally should carry their encoding in the header? Then the browser 
could get the encoding from there as it was done with earlier Tomcat versions.

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to