This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

anil prakash

Greenhorn
+ Follow
since Apr 24, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by anil prakash

we are not able to retain the greek characters after zipping the files(that contain greek characters). the following code shows u a clear sketch about how we are zipping the files on solaris platform.
ZipOutputStream out = null;
try
{



FileOutputStream f = new FileOutputStream(zipFileName);

out = new ZipOutputStream(new BufferedOutputStream(f));


for(int i = 0; i < fileNameLists.getNumElements(); i++)
{


BufferedReader in = new BufferedReader( new FileReader(fileNameLists.getNameAt(i)) );

out.putNextEntry(new ZipEntry(getFileName(fileNameLists.getNameAt(i))));
int c;
while((c = in.read()) != -1)
{
out.write(c);
}
in.close();
}
out.close();
if we are directly open the file which is stored in specified location its displaying greek characters(non-ascii) correctly but our application need to zip those files and save on windows platform.
so once we zip the files and download onto windows platform and extract the files its shows some garbage characters(may be using default character encoding of windows cp1252) instead of greek charcaters.

we tried in many ways using the setEncoding("iso-8859-7") and setEncoding("UTF-8") method in ZipOutPutStream even then no use.

is it because that zip utility while reading takes default character encoding of the platform?
wud be thankful if anyone cud provive solution for this
14 years ago
no doubt the browser is opening the file in excel(even the .CSV file wud get opened in excel only as far as my knowledge goes) but if the same file if i try to open with MSWord document its displaying THE GREEK CHARACTERS correctly with UTF-8 ENCODING but with the same UTF-8 encoding i am unable to display the greek characters correctly in excel sheet.
is there any alternative way to display the non-ascii characters correctly in excel?
14 years ago
my application need to display the greek data from jsp to the excel sheet
but i am not able to display the greek charcaters in excel even after using utf-8 character encoding. i tried with iso-8859-7 also even then its taking by default windows-latin encoding.

my code goes like this:
<%
Vector x = (Vector)session.getAttribute("QRES");

if (x != null)
{

response.setContentType("application/vnd.ms-excel:charset=UTF-8");
response.setHeader("Content-Disposition","attachment;filename=QueryResult.csv");








int iNoOfCols = (new Integer((String)request.getParameter("noOfCols"))).intValue();
String displayNames = ((String)request.getParameter("displayNames"));

out.println(displayNames);
out.println("\r\n");

for(int a = 0; a < x.size(); a = a + iNoOfCols)
{
String eachRow = "";
for (int b = 0; b < iNoOfCols ; b++)
{
if((x.elementAt(a+b)) != null)
{


eachRow=(x.elementAt(a+b)).toString();
}
else
{
eachRow += " ";
}
// comma seperated values...
eachRow += ",";


}




out.println(eachRow);
out.flush();
}
out.close();

}

does excel support UTF-8 character encoding if not do we have anyother alternative for this? wud be thankful if anyone cud provide solution for this
14 years ago