create zip files with arabic characters

Posted by fatiDev on Stack Overflow See other posts from Stack Overflow or by fatiDev
Published on 2012-09-26T09:18:50Z Indexed on 2012/09/26 9:38 UTC
Read the original article Hit count: 274

Filed under:
|
|
|
|

i have the following situation i have to modify an existing files and return a zip containing this modified files , i'm in web application context what i done up to now is :

///////////////// modifying the existing file with poi librairy 
    FileInputStream inpoi = new   FileInputStream("file_path");
                POIFSFileSystem fs = new POIFSFileSystem(inpoi);
                HWPFDocument doc = new HWPFDocument(fs);
                Range r = doc.getRange();
                r.replaceText("<nomPrenom>","test"); 
               byte[] b =   doc.getDataStream();

//////////////////////// create the zip file and copy the modified files into it 
ZipOutputStream out = new ZipOutputStream(new FileOutputStream("my.zip"));
out.putNextEntry(new ZipEntry("file"));
for (int j = 0; j < b.length; j++) {
                out.write(b[j]);
              } 

the created zipped file can't be read correctly with word given that the original file is wrotten in arabic

© Stack Overflow or respective owner

Related posts about java

Related posts about file