Ant的复制任务败坏UTF-8个符号 [英] Ant copy task corrupts UTF-8 symbols
问题描述
我有一个的.properties在阿拉伯文译本文件。我用它来取代在HTML文件中的字符串。然而,当我开始复制任务,它彻底破坏的符号和我得到的是这样的:
اÙÙزادات
任何想法是什么造成这一点,我怎么能解决这个问题?
的build.xml
<目标名称=copyAndReplace>
<副本todir =...覆盖=是编码=UTF-8>
<文件集DIR =...包括=* HTML。>< /文件集>
< filterset>
<***属性filtersfile文件= />
< / filterset>
< /复制>
< /目标与GT;
我看到一些可能出现的问题:
-
在Java中,属性文件都被认为有ISO-8859-1编码。即使你不使用Java直接打交道,蚂蚁正在读取属性文件。我在打开的Vim和NetBeans编辑属性文件,当遇到这个问题。 vim以UTF-8和NetBeans在ISO-8859-1保存它。
-
您应该使用的 outputencoding 属性=http://ant.apache.org/manual/Tasks/copy.html相对=nofollow的>
复制
任务。在Windows中,UTF-8是不是默认的编码。
I have a .properties file with translations in Arabic. I am using it to replace strings in an html file. However, when I start the copy task, it completely corrupts the symbols and I get something like this: اÙÙزادات
Any idea what's causing this and how I can fix it?
build.xml
<target name="copyAndReplace">
<copy todir="..." overwrite="yes" encoding="UTF-8">
<fileset dir="..." includes="*.html"></fileset>
<filterset>
<filtersfile file="***.properties" />
</filterset>
</copy>
</target>
I see some possible problems:
In Java, Properties files are assumed to have ISO-8859-1 encoding. Even if you're not dealing directly with Java, ant is reading a property file. I've run into this problem when opening a property file in Vim and NetBeans editor. Vim saved it in UTF-8 and NetBeans in ISO-8859-1.
You should use the
outputencoding
attribute ofcopy
task. In Windows, UTF-8 is not the default encoding.
这篇关于Ant的复制任务败坏UTF-8个符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!