diff options
-rw-r--r-- | src/java/org/apache/poi/poifs/macros/VBAMacroReader.java | 3 | ||||
-rw-r--r-- | src/testcases/org/apache/poi/poifs/macros/TestVBAMacroReader.java | 10 | ||||
-rw-r--r-- | test-data/spreadsheet/60273.xls | bin | 0 -> 30208 bytes |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/java/org/apache/poi/poifs/macros/VBAMacroReader.java b/src/java/org/apache/poi/poifs/macros/VBAMacroReader.java index 21b535b104..42902d1311 100644 --- a/src/java/org/apache/poi/poifs/macros/VBAMacroReader.java +++ b/src/java/org/apache/poi/poifs/macros/VBAMacroReader.java @@ -41,6 +41,7 @@ import org.apache.poi.poifs.filesystem.DocumentNode; import org.apache.poi.poifs.filesystem.Entry; import org.apache.poi.poifs.filesystem.NPOIFSFileSystem; import org.apache.poi.poifs.filesystem.OfficeXmlFileException; +import org.apache.poi.util.CodePageUtil; import org.apache.poi.util.HexDump; import org.apache.poi.util.IOUtils; import org.apache.poi.util.RLEDecompressingInputStream; @@ -305,7 +306,7 @@ public class VBAMacroReader implements Closeable { break; case PROJECTCODEPAGE: int codepage = in.readShort(); - modules.charset = Charset.forName("Cp" + codepage); + modules.charset = Charset.forName(CodePageUtil.codepageToEncoding(codepage, true)); break; case STREAMNAME: streamName = readString(in, recordLength, modules.charset); diff --git a/src/testcases/org/apache/poi/poifs/macros/TestVBAMacroReader.java b/src/testcases/org/apache/poi/poifs/macros/TestVBAMacroReader.java index a001ad9896..df90c8f444 100644 --- a/src/testcases/org/apache/poi/poifs/macros/TestVBAMacroReader.java +++ b/src/testcases/org/apache/poi/poifs/macros/TestVBAMacroReader.java @@ -272,4 +272,14 @@ public class TestVBAMacroReader { assertNotNull(macros.get("NewMacros")); assertContains(macros.get("NewMacros"), "' dirty"); } + + @Test + public void bug60273() throws IOException { + //test file derives from govdocs1 147240.xls + File f = POIDataSamples.getSpreadSheetInstance().getFile("60273.xls"); + VBAMacroReader r = new VBAMacroReader(f); + Map<String, String> macros = r.readMacros(); + assertNotNull(macros.get("Module1")); + assertContains(macros.get("Module1"), "9/8/2004"); + } } diff --git a/test-data/spreadsheet/60273.xls b/test-data/spreadsheet/60273.xls Binary files differnew file mode 100644 index 0000000000..07933cff6f --- /dev/null +++ b/test-data/spreadsheet/60273.xls |