ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Incorrect reading of property containing accented chars from build.properties by custom task
Date Mon, 23 Apr 2012 16:03:47 GMT
On 2012-04-23, Lokesh Jain wrote:

> On 4/23/2012 1:53 PM, Stefan Bodewig wrote:
>> On 2012-04-21, Lokesh Jain wrote:

>>> But on a CentOS box, the same property is read by the task program
>>> along with some junk unicode chars. Consequently, the strings do not
>>> match which affects some of the internal logic of the ant task.
>> What is "the task programm"?  And how does it read the properties?
>> Maybe this one is expecting a different encoding than they have been
>> written with?
> I apologize for not being clear earlier. The task program refers to
> the java class used as the custom ant task. The property file is being
> read using Ant's built-in property task. What I meant to say was that
> the java custom task class field corresponding to ${APPLICATION_GUID}
> property had junk/incorrect chars for its value.

>> Does Ant's built-in property task (maybe using a prefix) work?
>> Something like

>> <property file="build.properties" prefix="foo"/>
>> <echo>${foo.APPLICATION_GUID}</echo>
> I am afraid echoing is also returning the same junk/incorrect chars.

In that case build.properties most likely is not ISO-8859-1 encoded, no
matter what your Firefox says 8-)

Can you perform a binary diff of the Windows and Linux generated files?

If the file happens to use the platform's native encoding and you cannot
change the code that generates it, you can use Ant's copy task with an
outputencoding of ISO-8859-1 to re-code it.

Maybe you should try (untested)

<copy file="build.properties" tofile="foo.properties"
      outputencoding="ISO8851-1" filtering="true"/>
<property file="foo.properties" prefix="foo"/>
<echo>${foo.APPLICATION_GUID}</echo>

to verify whether it is an encoding issue.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message