From 2d5db78a3b9dddf45a377f11b81536302eec47ef Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Fri, 5 Aug 2011 17:27:08 +0000 Subject: [PATCH] Fixed incorrect encoding of non-breaking space (0xA0) in SXSSF git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1154323 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 1 + .../apache/poi/xssf/streaming/SXSSFSheet.java | 2 +- .../xssf/usermodel/streaming/TestSXSSFCell.java | 16 +++++++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 4bf487c3e2..df691e8721 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + Fixed incorrect encoding of non-breaking space (0xA0) in SXSSF Support for conditional formatting in XSSF Support isRightToLeft and setRightToLeft on the common spreadsheet Sheet interface, as per existing HSSF support 50209 - Fixed evaluation of Subtotals to ignore nested subtotals diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java index 05dc3ec12e..d3b62a5b65 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java @@ -1502,7 +1502,7 @@ public class SXSSFSheet implements Sheet, Cloneable { _out.write(chars,last,counter-last); } - _out.write(" "); + _out.write(" "); last=counter+1; break; default: diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFCell.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFCell.java index f3daf4fd08..1f1f1beccd 100755 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFCell.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFCell.java @@ -19,7 +19,7 @@ package org.apache.poi.xssf.usermodel.streaming; -import org.apache.poi.ss.usermodel.BaseTestCell; +import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.SXSSFITestDataProvider; /** @@ -60,4 +60,18 @@ public class TestSXSSFCell extends BaseTestCell { "Only XSSFCells can be evaluated.", e.getMessage()); } } + + public void testXmlEncoding(){ + Workbook wb = _testDataProvider.createWorkbook(); + Sheet sh = wb.createSheet(); + Row row = sh.createRow(0); + Cell cell = row.createCell(0); + String sval = "<>\t\r\n\u00a0 &\"POI\'\u2122"; + cell.setCellValue(sval); + + wb = _testDataProvider.writeOutAndReadBack(wb); + + assertEquals(sval, wb.getSheetAt(0).getRow(0).getCell(0).getStringCellValue()); + + } } -- 2.39.5