You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "David Sanmartín (JIRA)" <ji...@apache.org> on 2009/07/14 16:34:59 UTC
[jira] Updated: (WW-3187) Stream result type charset
[ https://issues.apache.org/struts/browse/WW-3187?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Sanmartín updated WW-3187:
--------------------------------
Description:
Stream result type doesn't allow to set charset of the response.
Anyway I was getting that response in UTF-8 as defined in my server config. I discovered the problem when set the a default locale for my app in struts.properties. After adding "struts.locale=en_GB" I started to get the response of the stream results in ISO-8859-1 but not the data as I could point with Firebug.
Here is the response before adding the struts.locale catched with Firebug:
X-Powered-By Servlet/2.5
Server Sun Java System Application Server 9.1_02
Set-Cookie userLanguage=en_GB; Expires=Mon, 12-Oct-2009 14:25:46 GMT; Path=/
Content-Disposition inline
Content-Type text/plain
Transfer-Encoding chunked
Date Tue, 14 Jul 2009 14:25:47 GMT
The response after adding the struts.locale:
X-Powered-By Servlet/2.5
Server Sun Java System Application Server 9.1_02
Set-Cookie userLanguage=en_GB; Expires=Mon, 12-Oct-2009 14:27:35 GMT; Path=/
Content-Disposition inline
Content-Type text/plain;charset=ISO-8859-1
Content-Language en-GB
Transfer-Encoding chunked
Date Tue, 14 Jul 2009 14:27:37 GMT
I can solve this problem modifying my struts.xml file adding the charset after the contentType in param attribute but I think that's not the better way:
<result type="stream" name="success">
<param name="contentType">text/plain; charset=UTF-8</param>
<param name="inputName">inputStream</param>
</result>
My workmate posted more info about it in the struts2 mail list:
http://www.nabble.com/Stream-Result-and-Japanese-data-getting-corrupted-td22432726.html
was:
Stream result type doesn't allow to set charset of the response.
Anyway I was getting that response in UTF-8 as defined in my server config. I discovered the problem when set the a default locale for my app in struts.properties. After adding "struts.locale=en_GB" I started to get the response of the stream results in ISO-8859-1 but not the data as I could point with Firebug.
Here is the response before adding the struts.locale catched with Firebug:
X-Powered-By Servlet/2.5
Server Sun Java System Application Server 9.1_02
Set-Cookie userLanguage=en_GB; Expires=Mon, 12-Oct-2009 14:25:46 GMT; Path=/
Content-Disposition inline
Content-Type text/plain
Transfer-Encoding chunked
Date Tue, 14 Jul 2009 14:25:47 GMT
The response after adding the struts.locale:
X-Powered-By Servlet/2.5
Server Sun Java System Application Server 9.1_02
Set-Cookie userLanguage=en_GB; Expires=Mon, 12-Oct-2009 14:27:35 GMT; Path=/
Content-Disposition inline
Content-Type text/plain;charset=ISO-8859-1
Content-Language en-GB
Transfer-Encoding chunked
Date Tue, 14 Jul 2009 14:27:37 GMT
I can solve this problem modifying my struts.xml file:
<result type="stream" name="success">
<param name="contentType">text/plain; charset=UTF-8</param>
<param name="inputName">inputStream</param>
</result>
My workmate posted more info about it in the struts2 mail list:
http://www.nabble.com/Stream-Result-and-Japanese-data-getting-corrupted-td22432726.html
> Stream result type charset
> --------------------------
>
> Key: WW-3187
> URL: https://issues.apache.org/struts/browse/WW-3187
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.1.6
> Environment: Struts 2.1.6, Glassfish v2.1
> Reporter: David Sanmartín
>
> Stream result type doesn't allow to set charset of the response.
> Anyway I was getting that response in UTF-8 as defined in my server config. I discovered the problem when set the a default locale for my app in struts.properties. After adding "struts.locale=en_GB" I started to get the response of the stream results in ISO-8859-1 but not the data as I could point with Firebug.
> Here is the response before adding the struts.locale catched with Firebug:
> X-Powered-By Servlet/2.5
> Server Sun Java System Application Server 9.1_02
> Set-Cookie userLanguage=en_GB; Expires=Mon, 12-Oct-2009 14:25:46 GMT; Path=/
> Content-Disposition inline
> Content-Type text/plain
> Transfer-Encoding chunked
> Date Tue, 14 Jul 2009 14:25:47 GMT
> The response after adding the struts.locale:
> X-Powered-By Servlet/2.5
> Server Sun Java System Application Server 9.1_02
> Set-Cookie userLanguage=en_GB; Expires=Mon, 12-Oct-2009 14:27:35 GMT; Path=/
> Content-Disposition inline
> Content-Type text/plain;charset=ISO-8859-1
> Content-Language en-GB
> Transfer-Encoding chunked
> Date Tue, 14 Jul 2009 14:27:37 GMT
> I can solve this problem modifying my struts.xml file adding the charset after the contentType in param attribute but I think that's not the better way:
> <result type="stream" name="success">
> <param name="contentType">text/plain; charset=UTF-8</param>
> <param name="inputName">inputStream</param>
> </result>
> My workmate posted more info about it in the struts2 mail list:
> http://www.nabble.com/Stream-Result-and-Japanese-data-getting-corrupted-td22432726.html
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.