Bug 55594 - SXSSF producing corrupt workbooks on z/OS with EBCDIC-Encoding
Summary: SXSSF producing corrupt workbooks on z/OS with EBCDIC-Encoding
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: SXSSF (show other bugs)
Version: 3.9-FINAL
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
: 56999 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-09-25 09:24 UTC by Constantin
Modified: 2014-09-22 13:44 UTC (History)
1 user (show)



Attachments
Content of sheet1.xml in text editor and error messages by excel (530.03 KB, image/jpeg)
2013-09-25 09:24 UTC, Constantin
Details
Patch as described in previous comment (1.84 KB, patch)
2014-03-21 15:22 UTC, Paul Vonnahme
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Constantin 2013-09-25 09:24:43 UTC
Created attachment 30880 [details]
Content of sheet1.xml in text editor and error messages by excel

Hello,

we are using the POI-API in version 3.9 on a z/OS system.
On this platform we have the default encoding "EBCDIC".

We are now facing problems using the SXXSFWorkbook.
We receive corrupt Excel-XML, because within "\xl\worksheets" the sheets are corrupt.
The data between <sheetData> and </sheetData> is in wrong Encoding.

Please find attached a screenshot of the xml-content and the Excel message boxes.

I think, that the writing into sheet-file will be done in platform encoding, but writing of resulting workbook will explicity be done using "UTF-8".

Thanks and best regards
Constantin
Comment 1 Constantin 2013-09-25 10:51:02 UTC
Hi all,

we found a way to fix this problem:

We changed method 
Writer createWriter(File fd)
in org.apache.poi.xssf.streaming.GZIPSheetDataWriter and org.apache.poi.xssf.streaming.SheetDataWriter.

Following changes have been done:
GZIPSheetDataWriter.createWriter(File fd) ... {
   return new BufferedWriter(new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(fd)), "UTF-8"));
}
SheetDataWriter.createWriter(File fd) ... {
   return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fd), "UTF-8"));
}

We force writing data with UTF-8 encoding, because the whole workbook will be written in UTF-8 as well.

Best regards
Constantin
Comment 2 Dominik Stadler 2013-10-14 20:10:28 UTC
Reopen as I changing this in general sounds like the right thing to do to avoid similar issues for other environments with other encodings as well.
Comment 3 Paul Vonnahme 2014-03-21 15:20:45 UTC
I can confirm the fix reported works for us as well.
Comment 4 Paul Vonnahme 2014-03-21 15:22:24 UTC
Created attachment 31421 [details]
Patch as described in previous comment
Comment 5 Nick Burch 2014-03-22 20:50:05 UTC
Thanks for the patch, applied in r1580314.
Comment 6 Dominik Stadler 2014-09-22 13:44:13 UTC
*** Bug 56999 has been marked as a duplicate of this bug. ***