我正在尝试获取 xml 文件中节点的值。我观察到这个值是错误的。我相信问题是编码。有人可以帮助我吗?下面是我的代码:
在 xml 文件中:
<?xml version="1.0" encoding="UTF-8" ?>
<projects>
<project>
<application>Padrão</application> <!-- The problem is the character ~ -->
<name>padrao</name>
<icon>c:\buffer</icon>
<market>br.com.tls.test</market>
</project>
</projects>
我的蚂蚁代码
<xmltask source="config.xml" encoding="UTF-8">
<call path="//project">
<param name="name" path="name/text()" />
<param name="market" path="market/text()" />
<param name="icon" path="icon/text()" />
<param name="application" path="application/text()" />
<actions>
<echo message="@{application}" />
<init-release name="@{name}" market="@{market}" icon="@{icon}" application="@{application}"/>
</actions>
</call>
</xmltask>
结果
[echo]: padr#o
预期的
[echo]: padrão
解决方案
我将文件更改为 UTF-8,我会成功替换。