I have an XSL file which contains the following text:
<xsl:variable name="orderName" select="'@ORDER_NAME@'"/>
At the top of the XSL file the encoding is set to UTF-8
<?xml version="1.0" encoding="UTF-8"?>
And if I check the file properties in Eclipse, the Text file encoding is listed as: Default (determined from content type: UTF-8)
There is then an ANT filter set file:
<project name="filterset" basedir=".">
<property name="conn" value="TEST"/>
<filterset id="conn_props">
<filter token="ORDER_NAME" value="${ORDER_NAME}"/>
</filterset>
</project>
The value of ORDER_NAME is then defined in a .properties file
ORDER_NAME=电子客票
Here's an excerpt from the ANT deploy.xml which is run for deployment
<copy todir="${working.dir}/config" failonerror="false" overwrite="true" encoding="UTF-8">
<fileset dir="${supplier.dir}">
<include name="Supplier/**/*.xsl"/>
<include name="Supplier/**/*.xml"/>
</fileset>
<filterset refid="conn_props"/>
</copy>
This should copy the XSL file from the Supplier directory to the config directory and replacing the ORDER_NAME token. However after deploying the project and opening the file the text is corrupted to:
<xsl:variable name="orderName" select="'çµå客ç¥'"/>
I'm running this on Windows 7 64-bit, on Eclipse Juno 32 bit with ANT 1.7.1 (Ant version cannot be upgraded). I have seen similar questions, but not any with satisfactory answers (or any that seem to apply to this particular scenario). Thanks.
I solved this myself, but it is possible others were not able to duplicate my issue as a result of me leaving information out of my original question for simplification (I've since edited the question for clarity).
The problem was the file type of the properties file containing:
was UTF-8 and it needs to be ISO-8859-1, as this is what is expected by ANT, see: Apache Ant Property
So converting the file to be ISO-8859-1 and redefining ORDER_NAME:
Results in the XSL file containing:
As expected.