]> source.dussan.org Git - poi.git/commitdiff
force ASCII encoding when compiling sources, fixed unmappable characters for encoding...
authorYegor Kozlov <yegor@apache.org>
Sun, 13 Jun 2010 06:26:14 +0000 (06:26 +0000)
committerYegor Kozlov <yegor@apache.org>
Sun, 13 Jun 2010 06:26:14 +0000 (06:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@954172 13f79535-47bb-0310-9956-ffa450edef68

build.xml
src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDataFormatter.java

index f0273024c6f050f606947b71b0c1c95fe559e9f4..6de19159dd1230bb6a48b621ec663acc93fd731a 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -66,6 +66,9 @@ under the License.
     <property name="jdk.version.class" value="1.5" description="JDK version of generated class files"/>
     <property name="compile.debug" value="true"/>
 
+    <!-- issue warnings if source code contains unmappable characters for encoding ASCII  -->
+    <property name="java.source.encoding" value="ASCII"/>
+
     <!--
       JVM system properties for running tests,
       user.language and user.country are required as we have locale-sensitive formatters
@@ -421,6 +424,7 @@ under the License.
                destdir="${main.output.dir}"
                srcdir="${main.src}"
                debug="${compile.debug}"
+               encoding="${java.source.encoding}"
                fork="yes">
             <classpath refid="main.classpath"/>
         </javac>
@@ -429,6 +433,7 @@ under the License.
                destdir="${main.output.test.dir}"
                srcdir="${main.src.test}"
                debug="${compile.debug}"
+               encoding="${java.source.encoding}"
                fork="yes">
             <classpath>
                 <path refid="main.classpath"/>
@@ -446,6 +451,7 @@ under the License.
                destdir="${scratchpad.output.dir}"
                srcdir="${scratchpad.src}"
                debug="${compile.debug}"
+               encoding="${java.source.encoding}"
                fork="yes">
             <classpath refid="scratchpad.classpath"/>
         </javac>
@@ -454,6 +460,7 @@ under the License.
                destdir="${scratchpad.output.test.dir}"
                srcdir="${scratchpad.src.test}"
                debug="${compile.debug}"
+               encoding="${java.source.encoding}"
                fork="yes">
             <classpath>
                 <path refid="scratchpad.classpath"/>
@@ -472,6 +479,7 @@ under the License.
                destdir="${contrib.output.dir}"
                srcdir="${contrib.src}"
                debug="${compile.debug}"
+               encoding="${java.source.encoding}"
                fork="yes">
             <classpath refid="contrib.classpath"/>
         </javac>
@@ -481,6 +489,7 @@ under the License.
                destdir="${contrib.output.test.dir}"
                srcdir="${contrib.src.test}"
                debug="${compile.debug}"
+               encoding="${java.source.encoding}"
                fork="yes">
             <classpath>
                 <path refid="contrib.classpath"/>
@@ -495,6 +504,7 @@ under the License.
                destdir="${examples.output.dir}"
                srcdir="${examples.src}"
                debug="${compile.debug}"
+               encoding="${java.source.encoding}"
                fork="yes">
             <classpath>
                 <path refid="ooxml.classpath"/>
@@ -513,6 +523,7 @@ under the License.
                source="${jdk.version.source}"
                destdir="${ooxml.output.dir}"
                srcdir="${ooxml.src}"
+               encoding="${java.source.encoding}"
                debug="${compile.debug}">
             <classpath refid="ooxml.classpath"/>
         </javac>
@@ -521,6 +532,7 @@ under the License.
                destdir="${ooxml.output.test.dir}"
                srcdir="${ooxml.src.test}"
                debug="${compile.debug}"
+               encoding="${java.source.encoding}"
                fork="yes">
             <classpath>
                 <path refid="ooxml.classpath"/>
@@ -547,7 +559,9 @@ under the License.
         <!-- Compile -->
         <javac target="${jdk.version.class}" source="${jdk.version.source}"
                failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes"
-               srcdir="${main.output.dir}"/>
+               srcdir="${main.output.dir}"
+               encoding="${java.source.encoding}">
+        </javac>
         <!-- Tidy up -->
         <delete file="${version.java}"/>
     </target>
index ed2da48bd4ce07fa30d6a2c8da54aae088df1ef8..00b3afad8ff337e06f8b01e62a2034cceabc6ed5 100644 (file)
@@ -251,7 +251,7 @@ public final class TestExcelExtractor extends TestCase {
       );
       assertTrue(
             text.indexOf(
-               "£nn.nn\t£10.52\n"
+               "\u00a3nn.nn\t\u00a310.52\n"
             ) > -1
       );
        }
index e5f1f8129cb00f8fa772ab82f7221497ed619618..4759a6c04ba0edfe35321dfe78213de01db3160b 100644 (file)
@@ -405,9 +405,9 @@ public final class TestHSSFDataFormatter extends TestCase {
       assertEquals("10.5", f.formatCellValue(sheet.getRow(11).getCell(1)));
 
       // text isn't quite the format rule...
-      assertEquals("£nn.nn", sheet.getRow(12).getCell(0).getStringCellValue());
-      assertEquals("\"£\"#,##0.00", sheet.getRow(12).getCell(1).getCellStyle().getDataFormatString());
-      assertEquals("£10.52", f.formatCellValue(sheet.getRow(12).getCell(1)));
+      assertEquals("\u00a3nn.nn", sheet.getRow(12).getCell(0).getStringCellValue());
+      assertEquals("\"\u00a3\"#,##0.00", sheet.getRow(12).getCell(1).getCellStyle().getDataFormatString());
+      assertEquals("\u00a310.52", f.formatCellValue(sheet.getRow(12).getCell(1)));
        }
 
        private static void log(String msg) {