You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Canos <da...@gmail.com> on 2009/07/14 16:10:48 UTC

Re: Stream Result and Japanese data getting corrupted

Hi folks i'm facing the same problem.

if a setup *struts.locale=en_GB* in struts.properties I get
ISO-8859-1 instead of UTF-8 in some result-type text/plain received.
before set up this locale property it worked fine... and all other GETs and
POSTs queries are working as expected in UTF-8...

Is there a way to set the charset in a result stream-type?
the answer is yes in a little dirty way....

<result type="stream" name="success">
<param name="contentType">text/plain*;charset=UTF-8*</param>
        <param name="inputName">inputStream</param>
</result>

can anyone change add this to the wiki?

2009/3/10 shyamb <sh...@gmail.com>

>
> Hi,
>
> I am using Struts2 Stream Result for Downloading To Excel, by constructing
> the inputStream as required for Stream Result as :
>
> inputStream = new
> ByteArrayInputStream(getSomeStringData().getBytes("UTF-8"));
>
> My action is configured in struts.xml as follows
> <result name="sendFile" type="stream">
>   application/csv
>   UTF-8
>   inputStream
> attachment:filename="CasesDetails.csv"
>
>                                1024
>                        </result>
>
> In my jsp page there is a button on click of which I am calling the Action
> and I also put in this page the following:
>
> <%@page pageEncoding="UTF-8"%>
> <%@page contentType="text/html;charset=UTF-8"%>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
>
> The problem which I am facing is when the method getSomeStringData() is
> returning Japanese or Chinese characters. In such scenarios the excel file
> data is containing junk characters (?????) etc.
>
> Has anyone faced a similar problem or anyone has any solutions for fixing
> this issue
> --
> View this message in context:
> http://www.nabble.com/Stream-Result-and-Japanese-data-getting-corrupted-tp22432726p22432726.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>