蚂蚁替换任务UTF-8的文件破坏的符号 [英] Ant replace task corrupts symbols in UTF-8 file
问题描述
我有以下Ant任务:
<target name="test">
<replace file="test.txt" token="smth" value="anything"/>
</target>
test.txt的是UTF-8 EN codeD。问题是,当我运行这个任务结果
它破坏了一些UTF-8符号(其中只有少数,不是所有)。结果
我试图用蚂蚁-Dfile.encoding = UTF-8 -buildfile =的build.xml
,结果
并指定build.xml文件编码&LT;?XML版本=1.0编码=UTF-8&GT;
,结果
但问题仍然存在。
test.txt is UTF-8 encoded. The problem is that when I run this task
it corrupts some UTF-8 symbols (only few of them, not all).
I've tried to use ant -Dfile.encoding=UTF-8 -buildfile=build.xml
,
and specified build.xml encoding <?xml version="1.0" encoding="UTF-8">
,
but the problem remains.
我怎样才能让我的Ant任务工作正确使用UTF-EN codeD文件?
How can I make my Ant task work correctly with UTF-encoded files?
推荐答案
属性:编码结果
说明:取代操作在其上的文件的编码结果。
默认值:无 - 默认为默认的JVM编码
Attribute: encoding
Description: The encoding of the files upon which replace operates.
Default: No - defaults to default JVM encoding
所以它的使用平台默认的编码。如果你想让它使用UTF-8,只需更改您的来电:
So it's using the platform default encoding. If you want it to use UTF-8, just change your call to:
<replace file="test.txt" token="smth" value="anything"
encoding="UTF-8" />
这篇关于蚂蚁替换任务UTF-8的文件破坏的符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!