tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32499] - Headers: charset added to image Content-Type
Date Mon, 23 Apr 2007 23:49:28 GMT
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=32499>.
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=32499


sbridges.geo@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |
            Version|Unknown                     |5.5.17




------- Additional Comments From sbridges.geo@yahoo.com  2007-04-23 16:49 -------
This bug 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 the bug 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 this bug 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());

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;

It may be better if the ResponseObject has a reference to the locale, and if a
default char set is needed, the charset is read from the locale.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message