tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: Tomcat 7 faces servlet encoding issue
Date Sat, 30 Jul 2011 17:02:01 GMT
2011/7/30 honyk <j.tosovsky@email.cz>:
>> > In tomcat 6 there is no difference between these two links
>> > http://drifted.in/encoding/encoding.svg
>> > http://drifted.in/encoding/faces/encoding.svg
>> >
>> > but in Tomcat 7 I am getting different results. The first is Ok while
>> > the second, processed by faces servlet, breaks the encoding.
>
>> You have to examine what is actually is being sent to the browser.
>> (The actual content of the stream and any HTTP headers that come with
>> it).
>
> Thanks for that hint.
> http://drifted.in/encoding/encoding.svg returns HTTP Content-type
> image/svg+xml (according to Firebug)
> but http://drifted.in/encoding/faces/encoding.svg returns
> image/svg+xml;charset=ISO-8859-1
>
> In Tomcat 6 powered web I am getting just 'image/svg+xml' in both cases.
>
>> There are many ways how the things might break, but you are not saying
>> what is "break" for you - what you are actually observing.
>
> http://drifted.in/encoding/faces/index.xhtml - both HTML and SVG texts
> should match
> Now I see the Content-type of that HTML page is text/html;charset=UTF-8
> while that SVG in it is image/svg+xml;charset=ISO-8859-1
>

1) What encoding is specified in <?xml> header in the svg file?

2) I suspect that you are using getWriter() to write the file
somewhere.  That will add encoding to the content type if you are
running Tomcat 7,

and IIRC  you wil also observe this if you are running Tomcat 6 with
*.STRICT_SERVLET_COMPLIANCE system property set to "true".


Maybe there is a filter that does getWriter(),  or you are serving the
file not as a whole response, but with include() call (like
jsp:include action in JSPs).

>> Are both Tomcats on the same system? Maybe your system encoding is
>> different?
>
> It has been tested on my PC initially (Win7/64bit), but the same result I am
> getting now on Linux Debian (hosted site).
>
>> What component writes the svg file to the response stream, and how it
>> does that?
>
> In this test case the SVG file is static, just included in WAR.

So, is it directly served by Tomcat's DefaultServlet?

> So Tomcat 7 seem to be maybe too active with adding that encoding when not
> it is not specified. I am just thinking where to specify that encoding for
> standalone SVG files. In web.xml?

It can be done in mime type mapping in web.xml

Best regards,
Konstantin Kolinko

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


Mime
View raw message