Bugzilla 53360 - Fixed SXSSF to correctly write text before escaped Unicode control character

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1362093 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2012-07-16 15:32:25 +00:00
parent ace1bade16
commit e353c5e20b
3 changed files with 12 additions and 0 deletions

View File

@ -34,6 +34,7 @@
<changes>
<release version="3.9-beta1" date="2012-??-??">
<action dev="poi-developers" type="fix">53360 - Fixed SXSSF to correctly write text before escaped Unicode control character</action>
<action dev="poi-developers" type="add">Change HSMF Types to have full data on ID, Name and Length, rather than just being a simple ID</action>
<action dev="poi-developers" type="add">48469 - Updated case study</action>
<action dev="poi-developers" type="add">53476 - Support Complex Name in formulas </action>

View File

@ -278,6 +278,9 @@ public class SheetDataWriter {
// the same rule applies to unicode surrogates and "not a character" symbols.
if( c < ' ' || Character.isLowSurrogate(c) || Character.isHighSurrogate(c) ||
('\uFFFE' <= c && c <= '\uFFFF')) {
if (counter > last) {
_out.write(chars, last, counter - last);
}
_out.write('?');
last = counter + 1;
}

View File

@ -154,6 +154,14 @@ public final class TestSXSSFWorkbook extends BaseTestWorkbook {
tmp = wr.getTempFile();
assertTrue(tmp.getName().startsWith("poi-sxssf-sheet-xml"));
assertTrue(tmp.getName().endsWith(".gz"));
//Test escaping of Unicode control characters
wb = new SXSSFWorkbook();
wb.createSheet("S1").createRow(0).createCell(0).setCellValue("value\u0019");
XSSFWorkbook xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
Cell cell = xssfWorkbook.getSheet("S1").getRow(0).getCell(0);
assertEquals("value?", cell.getStringCellValue());
}
public void testGZipSheetdataWriter(){