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="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>

View File

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

View 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) {