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 36790] - response.setContentType() never forgets "charset"
Date Sat, 24 Sep 2005 17:17:23 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=36790>.
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=36790


jafshar@vignette.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




------- Additional Comments From jafshar@vignette.com  2005-09-24 19:17 -------
I understand the character encoding defaults to ISO-8859-1, but I guess it boils
down to for the following servlet code, shouldn't the Content-Type be
"application/x-foobar"? Tomcat 5.0.28 is sending
"application/x-foobar;charset=utf-8".

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
		response.setContentType("text/html; charset=utf-8");
		response.setContentType("application/x-foobar");
		response.getOutputStream().println(new java.util.Date().toString());
		response.getOutputStream().close();
    }

The spec doesn't seem clear on what happens when setContentType() is called a
second time without a charset, but it does seem clear that "charset" should only
get added for "text/*" MIME types.

Is the standard clear on whether "charset" should be sent if the servlet does this?

		response.setContentType("text/html; charset=utf-8");
		response.setContentType("text/html");

Should the response default back to ISO-8859-1, and should the Content-Type have
";charset=ISO-8859-1" appended?

SRV.5.4 Internationalization
...
The setCharacterEncoding, setContentType, and
setLocale methods can be called repeatedly to change the character encoding.
Calls made after the servlet response’s getWriter method has been called or after
the response is committed have no effect on the character encoding. Calls to
setContentType set the character encoding only if the given content type string
provides a value for the charset attribute.
...
In the case of HTTP, the locale is communicated via the Content-
Language header, the character encoding as part of the Content-Type header for
text media types.

-- 
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: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message