ant方式
<?xml version="1.0"?>
<project name="helloworld" default="encoding">
<property name="target.dir" value="${basedir}/target"/>
<property name="output.encoding" value="UTF-8"/>
<target name="encoding">
<copy todir="${target.dir}" outputencoding="${output.encoding}">
<fileset dir="${basedir}">
<include name="**/EncodingTest.java"/>
</fileset>
<filterset>
<filter token="ENCODING" value="${output.encoding}"/>
</filterset>
</copy>
</target>
</project>
linux iconv命令
iconv -f GBK -t UTF-8 EncodingTest.java -o tt.java
本文介绍如何使用Ant工具进行项目构建,并实现特定文件的编码转换。通过配置XML文件,可以指定文件过滤条件及目标编码格式,适用于批量处理源代码文件的场景。此外,还提到了在Linux环境下使用iconv命令进行文件编码转换的方法。
523

被折叠的 条评论
为什么被折叠?



