Hello,

I originally posted this as a comment to bug 32499,
(http://issues.apache.org/bugzilla/show_bug.cgi?id=32499),
and was told to send it to the users mailing list.

Bug 32499 was marked as a duplicate of 24970, but it
is not a duplicate.  

Bug 24970 was marked as wont fix, which is
appropriate.  The justification for 24970 being won't
fix is in comment #24 on bug 24970 which reads,

"The servlet spec expert group has decided that all
Servlets that use a Writer (and this includes all
JSPs) must include a charset in the 2.4 servlet spec.
Since Tomcat 4 uses the same connectors as Tomcat 5,
and Tomcat 5 must set the charset, this will certainly
not be fixed."

However the code for bug 32499 does not use a servlet
or a JSP. 

As a test, execute this code in a servlet using Tomcat
5.5.17,

HttpServletResponse sresp = ...
sresp.setContentType("application/xml");
System.out.println(sresp.getContentType());

this will print,

application/xml;charset=ISO-8859-1

This bug makes serving xml files particularly
difficult as the charset may be set in the xml
declaration <?xml charset='...' ?>, or by the first
several bytes of the xml file.  Often when serving
xml, you want to set the mime type as application/xml,
and let the client parser determine the charset from
the file contents.

Tracing through the code, it seems this bug stems from
the Response.setLocale(Locale locale) method calling,
coyoteResponse.setCharacterEncoding(charset).

In the method setCharacterEncoding(String charset),
there is the line charsetSet=true;

Thanks,

Sean

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to