Home arrow static arrow Java Programming [Archive] - the ZipOutputStream encoding...
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - the ZipOutputStream encoding...
This topic has 4 replies on 1 page.

Posts:47
Registered: 4/1/03
the ZipOutputStream encoding...  
Jul 28, 2004 5:30 AM



 
hi,i got a problem

//---------------------------------------------

....................
String EntryName = "source.txt";
ZipOutputStream fout = new ZipOutputStream( new FileOutputStream("test.zip") );
fout.putNextEntry(new ZipEntry(EntryName));
while ( fin.read(c)!=-1 )
{
fout.write(c,0,1024);
}
fin.close();
fout.close();
...........................


ZipEntry

i used above code to creat a new file of zip and it will work fine, the filename "source.txt" in the test.zip is

correct

but when the String "EntryName" does not consist of english word ,it still create a new file of zip successfully,but the filename will changed like "??? ?"

how to deal with the file name?

thanks in advance

 

Posts:47
Registered: 4/1/03
Re: the ZipOutputStream encoding...  
Jul 28, 2004 3:22 PM (reply 1 of 4)



 
push
 

Posts:9,091
Registered: 8/15/01
Re: the ZipOutputStream encoding...  
Jul 28, 2004 3:54 PM (reply 2 of 4)



 
I'm quite sure WinZip is not Unicode friendly. Plus PKZip does come from days-of-old, pre Unicode enabled filesystems, and I'm nore sure it supports 'em.

So, you will have to use ASCII.
 

Posts:47
Registered: 4/1/03
Re: the ZipOutputStream encoding...  
Jul 28, 2004 8:26 PM (reply 3 of 4)



 
thanks
 

Posts:9,091
Registered: 8/15/01
Re: the ZipOutputStream encoding...  
Jul 28, 2004 8:42 PM (reply 4 of 4)



 
no problem
 
This topic has 4 replies on 1 page.