force ASCII encoding when compiling sources, fixed unmappable characters for encoding ASCII

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@954172 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yegor Kozlov 2010-06-13 06:26:14 +00:00
parent 1deea0cfa1
commit 9c6fdb6f53
3 changed files with 19 additions and 5 deletions

View File

@ -66,6 +66,9 @@ under the License.
<property name="jdk.version.class" value="1.5" description="JDK version of generated class files"/> <property name="jdk.version.class" value="1.5" description="JDK version of generated class files"/>
<property name="compile.debug" value="true"/> <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, JVM system properties for running tests,
user.language and user.country are required as we have locale-sensitive formatters user.language and user.country are required as we have locale-sensitive formatters
@ -421,6 +424,7 @@ under the License.
destdir="${main.output.dir}" destdir="${main.output.dir}"
srcdir="${main.src}" srcdir="${main.src}"
debug="${compile.debug}" debug="${compile.debug}"
encoding="${java.source.encoding}"
fork="yes"> fork="yes">
<classpath refid="main.classpath"/> <classpath refid="main.classpath"/>
</javac> </javac>
@ -429,6 +433,7 @@ under the License.
destdir="${main.output.test.dir}" destdir="${main.output.test.dir}"
srcdir="${main.src.test}" srcdir="${main.src.test}"
debug="${compile.debug}" debug="${compile.debug}"
encoding="${java.source.encoding}"
fork="yes"> fork="yes">
<classpath> <classpath>
<path refid="main.classpath"/> <path refid="main.classpath"/>
@ -446,6 +451,7 @@ under the License.
destdir="${scratchpad.output.dir}" destdir="${scratchpad.output.dir}"
srcdir="${scratchpad.src}" srcdir="${scratchpad.src}"
debug="${compile.debug}" debug="${compile.debug}"
encoding="${java.source.encoding}"
fork="yes"> fork="yes">
<classpath refid="scratchpad.classpath"/> <classpath refid="scratchpad.classpath"/>
</javac> </javac>
@ -454,6 +460,7 @@ under the License.
destdir="${scratchpad.output.test.dir}" destdir="${scratchpad.output.test.dir}"
srcdir="${scratchpad.src.test}" srcdir="${scratchpad.src.test}"
debug="${compile.debug}" debug="${compile.debug}"
encoding="${java.source.encoding}"
fork="yes"> fork="yes">
<classpath> <classpath>
<path refid="scratchpad.classpath"/> <path refid="scratchpad.classpath"/>
@ -472,6 +479,7 @@ under the License.
destdir="${contrib.output.dir}" destdir="${contrib.output.dir}"
srcdir="${contrib.src}" srcdir="${contrib.src}"
debug="${compile.debug}" debug="${compile.debug}"
encoding="${java.source.encoding}"
fork="yes"> fork="yes">
<classpath refid="contrib.classpath"/> <classpath refid="contrib.classpath"/>
</javac> </javac>
@ -481,6 +489,7 @@ under the License.
destdir="${contrib.output.test.dir}" destdir="${contrib.output.test.dir}"
srcdir="${contrib.src.test}" srcdir="${contrib.src.test}"
debug="${compile.debug}" debug="${compile.debug}"
encoding="${java.source.encoding}"
fork="yes"> fork="yes">
<classpath> <classpath>
<path refid="contrib.classpath"/> <path refid="contrib.classpath"/>
@ -495,6 +504,7 @@ under the License.
destdir="${examples.output.dir}" destdir="${examples.output.dir}"
srcdir="${examples.src}" srcdir="${examples.src}"
debug="${compile.debug}" debug="${compile.debug}"
encoding="${java.source.encoding}"
fork="yes"> fork="yes">
<classpath> <classpath>
<path refid="ooxml.classpath"/> <path refid="ooxml.classpath"/>
@ -513,6 +523,7 @@ under the License.
source="${jdk.version.source}" source="${jdk.version.source}"
destdir="${ooxml.output.dir}" destdir="${ooxml.output.dir}"
srcdir="${ooxml.src}" srcdir="${ooxml.src}"
encoding="${java.source.encoding}"
debug="${compile.debug}"> debug="${compile.debug}">
<classpath refid="ooxml.classpath"/> <classpath refid="ooxml.classpath"/>
</javac> </javac>
@ -521,6 +532,7 @@ under the License.
destdir="${ooxml.output.test.dir}" destdir="${ooxml.output.test.dir}"
srcdir="${ooxml.src.test}" srcdir="${ooxml.src.test}"
debug="${compile.debug}" debug="${compile.debug}"
encoding="${java.source.encoding}"
fork="yes"> fork="yes">
<classpath> <classpath>
<path refid="ooxml.classpath"/> <path refid="ooxml.classpath"/>
@ -547,7 +559,9 @@ under the License.
<!-- Compile --> <!-- Compile -->
<javac target="${jdk.version.class}" source="${jdk.version.source}" <javac target="${jdk.version.class}" source="${jdk.version.source}"
failonerror="true" destdir="${main.output.dir}" debug="on" fork="yes" 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 --> <!-- Tidy up -->
<delete file="${version.java}"/> <delete file="${version.java}"/>
</target> </target>

View File

@ -251,7 +251,7 @@ public final class TestExcelExtractor extends TestCase {
); );
assertTrue( assertTrue(
text.indexOf( text.indexOf(
"£nn.nn\10.52\n" "\u00a3nn.nn\t\u00a310.52\n"
) > -1 ) > -1
); );
} }

View File

@ -405,9 +405,9 @@ public final class TestHSSFDataFormatter extends TestCase {
assertEquals("10.5", f.formatCellValue(sheet.getRow(11).getCell(1))); assertEquals("10.5", f.formatCellValue(sheet.getRow(11).getCell(1)));
// text isn't quite the format rule... // text isn't quite the format rule...
assertEquals("£nn.nn", sheet.getRow(12).getCell(0).getStringCellValue()); assertEquals("\u00a3nn.nn", sheet.getRow(12).getCell(0).getStringCellValue());
assertEquals("\"£\"#,##0.00", sheet.getRow(12).getCell(1).getCellStyle().getDataFormatString()); assertEquals("\"\u00a3\"#,##0.00", sheet.getRow(12).getCell(1).getCellStyle().getDataFormatString());
assertEquals("£10.52", f.formatCellValue(sheet.getRow(12).getCell(1))); assertEquals("\u00a310.52", f.formatCellValue(sheet.getRow(12).getCell(1)));
} }
private static void log(String msg) { private static void log(String msg) {