struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Canos <davidca...@gmail.com>
Subject Re: Stream Result and Japanese data getting corrupted
Date Tue, 14 Jul 2009 14:10:48 GMT
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 <shyam.bhaskaran@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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message