From b835619942b86fba013c054a2a37ef823e33897a Mon Sep 17 00:00:00 2001 From: gongxuanzhang Date: Fri, 21 Apr 2023 11:48:58 +0800 Subject: [PATCH] fix utf decode --- .../alibaba/easyexcel/test/demo/rare/ReadTest.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/demo/rare/ReadTest.java b/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/demo/rare/ReadTest.java index c1e614ea..2d8eb1d7 100644 --- a/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/demo/rare/ReadTest.java +++ b/easyexcel-test/src/test/java/com/alibaba/easyexcel/test/demo/rare/ReadTest.java @@ -8,13 +8,12 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.junit.Assert; import org.junit.Test; -import java.io.File; import java.util.List; import java.util.Map; /** - * * 记录一些不太常见的案例 + * * @author gxz gongxuanzhang@foxmail.com **/ public class ReadTest { @@ -22,20 +21,18 @@ public class ReadTest { /** * 当excel有需要转义的 如x005特殊符号时需要通过utf decode解码 - * **/ @Test - public void readX005() throws Exception{ + public void readX005() throws Exception { String fileName = TestFileUtil.pathBuild().sub("temp").sub("utfdecode").sub("demo.xlsx").getPath(); XSSFWorkbook xssfWorkbook = new XSSFWorkbook(fileName); XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(0); XSSFRow row = xssfSheet.getRow(0); String poiValue = row.getCell(0).getStringCellValue(); - List> list = EasyExcel.read(fileName) - //.useDefaultListener(false) + List> list = EasyExcel.read(fileName) .sheet(0) .headRowNumber(0).doReadSync(); Map easyExcelRow = list.get(0); - Assert.assertEquals(easyExcelRow.get(0).toString(),poiValue); + Assert.assertEquals(easyExcelRow.get(0).toString(), poiValue); } }