开发者

How to prevent ant build changing national characters when replacing characters in xml

The problem I am facing is whenever I try to build my app with Ant I need to change some values in strings.xml. The value I am parsing through the replacefilter are some swedish national characters. But they are getting changed after the buid is 开发者_开发百科done.

In build.xml I write :

<replace file="res\values\strings.xml">
<replacefilter token="@APP_NAME@" value="${application.name}" />

in properties file: ånimal

in strings.xml the value <string name="app_name">@APP_NAME@</string> is getting changed to <string name="app_name">Ã¥nimal</string>

I've tried using utf-8 and ISO-8859-1 in both my build.xml and strings.xml Anyone got any answers? Please help.


The problem is not in the <replace> task, but in <property file="..."/>. This is where the value is first incorrectly translated.

Use the following instead:

<loadproperties srcFile="application.properties" encoding="utf-8"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜