Hi,
Am facing problem displaying double byte character from an excel file in the browser. The following are the steps done,
1. Generated an excel file in UTF8 converted this file into UnicodeLittle. The double byte characters appear properly in the excel file.
2. When I try to download the excel file through a servlet then the characters are not appearing properly.
This program runs in NES/NAS(NES in one machine and NAS in another machine; OS - Solaris)
Please advice what is wrong, and also any round abouts that has to be followed.
The following is the code used to download the file
public class ExcelDownload extends HttpServlet
{
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
try
{
String fileName1 = System.getProperty( "GX.path.class" ) +"/xyz/a.csv";
FileInputStream infile = new FileInputStream(new File(fileName1));
Reader r = new BufferedReader(new InputStreamReader(infile,"UnicodeLittle"));
res.setContentType("application/vnd.ms-excel");
PrintWriter out = res.getWriter();
char[] buffer = new char[4096];
int len;
while((len = r.read(buffer)) != -1)
out.write(buffer, 0, len);
out.close();
out.flush();
}//end try
catch(Exception e)
{System.out.println("Error e :"+e);e.printStackTrace();}
}
}
Regards,
Prem
Double byte character not appearing properly when Excel file is d ownloaded
Swaminathan, Prem (GEP, Contractor) Mon, 23 Sep 2002 03:44:09 -0700
Title: Double byte character not appearing properly when Excel file is downloaded
- Re: Double byte character not appearin... Swaminathan, Prem (GEP, Contractor)
- Re: Double byte character not app... lneelaka