tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Randy George" <>
Subject RE: default charset in contentType?
Date Fri, 11 Oct 2002 13:18:18 GMT

	Too bad!

	Setting the charset explicity in the Jasper compiled servlet breaks IE for
image/svg+xml content. It seems that Microsoft does not properly recognize
the contentType header so that for example running the resulting servlet
http://localhost:8080/foo/servlet/test?dummy=.svg will work but running it
properly thus: http://localhost:8080/foo/servlet/test will not work?
Obviously trying to fool IE with a dummy appended parameter won't help with
actual .jsp pages.

	Tomcat 4.0 and below did not explicitly set the charset unless asked to, so
it works fine.

	Perhaps there is a work around short of modifying the Jasper compiler?


-----Original Message-----
From: Craig R. McClanahan []
Sent: Thursday, October 10, 2002 1:47 PM
To: Tomcat Users List
Subject: Re: default charset in contentType?

On Thu, 10 Oct 2002, Randy George wrote:

> Date: Thu, 10 Oct 2002 13:14:20 -0600
> From: Randy George <>
> Reply-To: Tomcat Users List <>
> To: Tomcat Users List <>
> Subject: default charset in contentType?
> Is there a way to turn off the default charset appended to contentType by
> Jasper?

The JSP spec states that the default character encoding, unless you
specify otherwise (on a "contentType" or "pageEncoding" attribute on the
<%@ page %> directive) must be ISO-8859-1.


> 	I have installed Tomcat 4.1.10 on a W2K server and I'm trying to display
> SVG content with JSP. I have added the image/svg+xml Mime types to my
> 4.1\conf\web.xml file:
>     <mime-mapping>
>         <extension>svg</extension>
>         <mime-type>image/svg+xml</mime-type>
>     </mime-mapping>
> 	However, when I attempt to set the response type to image/svg+xml in a
> page directive the IE6.0 client browser (ASV 3.0 plugin) fails to
> jsp generated svg content? Note that static svg content displays fine.
> occurs in even the simplest invocation:
> 	<%@ page contentType="image/svg+xml" %>
> 	<?xml version="1.0"?>
> 	<svg width="100px" height="20px">
>   	  <text x="10" y="20">SVG Test</text>
> 	</svg>
> 	When I examine the that comes out of the Jasper Compiler I
> can see that the servlet contentType has a default charset appended to the
> image/svg+xml i.e.
>       response.setContentType("image/svg+xml;charset=ISO-8859-1");
> 	Curiously if I then compile this Jasper generated servlet and run it I
> the same failure until I remove the ";charset=ISO-8859-1" making the
> contentType as follows:
>       response.setContentType("image/svg+xml");
> 	At that point everything works as expected?
> 	It appears that the Jasper JSP compiler adds a default charset=ISO-8859-1
> to the response contentType which does not work with the image/svg+xml
> type. I have tried explicitly setting charset in the page directive to
> utf-8, windows-1252 etc but it seems that any charset I have tried fails
> the same manner. At this point I would just like to disable the default
> charset appended by Jasper.
> Thanks
> Randy
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message