Encoding 在ANT中将文件转换为无BOM的UTF-8
我有一些js文件在Encoding 在ANT中将文件转换为无BOM的UTF-8,encoding,utf-8,ant,byte-order-mark,Encoding,Utf 8,Ant,Byte Order Mark,我有一些js文件在UTF-8BOM编码中。我想使用ant将这些文件转换为UTF-8编码。为此,我使用了ant的copy任务 <copy todir="./custom_plugins" overwrite="true" outputencoding="UTF-8"> <fileset dir="../plugins" /> </copy> 现在,当我在记事本++中打开一个位于UTF-8bom中的文件时,它会以ANSI格式显示其编码,但这也会在文件
UTF-8BOM
编码中。我想使用ant将这些文件转换为UTF-8
编码。为此,我使用了ant的copy
任务
<copy todir="./custom_plugins" overwrite="true" outputencoding="UTF-8">
<fileset dir="../plugins" />
</copy>
现在,当我在记事本++中打开一个位于UTF-8bom
中的文件时,它会以ANSI
格式显示其编码,但这也会在文件开头添加I»
字符
甚至我也试过了,但没有成功。
如何解决此问题?将这些文件编码为
UTF-8
后,我使用replaceregexp
ant任务删除/替换BOM字符\xEF\xBB\xBF
<replaceregexp match="\xEF\xBB\xBF" replace="" byline="true" encoding="UTF-8">
<fileset dir="./custom_plugins">
<include name="**/*.js"/>
</fileset>
</replaceregexp>