You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by shreedhar natarajan <sh...@ami.com> on 2006/01/10 01:45:51 UTC
Reading properties
hi all,
One of my property file has key/values such as
path=something\usb
When I read this property like
<property file="${build_dir}/myvalues.properties" />
ant throws an exception, C:\mydir\build.xml:35: java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
I understand that it interprets \u in usb as unicode char. how to over come this?
I tried to use a filter to change "\" to "\\"
<filter token="\" value="\\"/>
<copy file="${build_dir}/myvalues.properties" filtering="true" tofile="${build_dir}/myvalues1.properties" overwrite="true">
</copy>
It does not seem to work. What could be the problem ?
Bst rgds
Shreedhar
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Reading properties
Posted by Neil Benn <ne...@gmail.com>.
Hello,
I had a simialr problem to this, if you cannot switch \ to / (I
had a problem that I needed to replace a path whihc became a commadn line).
I ended up having to put four \ to replace one \. This ended up being two
for java and two for a regex although you are not using regexs - give that a
go.
Cheers,
Neil
On 1/10/06, shreedhar natarajan <sh...@ami.com> wrote:
>
> hi all,
>
> One of my property file has key/values such as
>
> path=something\usb
>
> When I read this property like
>
> <property file="${build_dir}/myvalues.properties" />
>
> ant throws an exception, C:\mydir\build.xml:35:
> java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
>
>
> I understand that it interprets \u in usb as unicode char. how to over
> come this?
>
> I tried to use a filter to change "\" to "\\"
>
> <filter token="\" value="\\"/>
> <copy file="${build_dir}/myvalues.properties" filtering="true"
> tofile="${build_dir}/myvalues1.properties" overwrite="true">
> </copy>
>
> It does not seem to work. What could be the problem ?
>
> Bst rgds
> Shreedhar
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
Re: Reading properties
Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 9 Jan 2006, shreedhar natarajan <sh...@ami.com> wrote:
> One of my property file has key/values such as
>
> path=something\usb
<snip/>
> I understand that it interprets \u in usb as unicode char.
Yes.
> I tried to use a filter to change "\" to "\\"
>
> <filter token="\" value="\\"/> <copy
> file="${build_dir}/myvalues.properties" filtering="true"
> tofile="${build_dir}/myvalues1.properties" overwrite="true"> </copy>
>
> It does not seem to work. What could be the problem ?
That filtering doesn't work as you expect. Have you checked that
myvalues1.properties has all the backslashes replaced?
filtering works on delimited token, which you don't have in your
properties file. You want to use a <replace> task instead.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
RE: Reading properties
Posted by bill/wilandra <bi...@wilandra.com>.
Try changing the \ to / in the file.
HTH Bill
-----Original Message-----
From: shreedhar natarajan [mailto:shreedharn@ami.com]
Sent: Monday, January 09, 2006 4:46 PM
To: Ant Users List
Subject: Reading properties
hi all,
One of my property file has key/values such as
path=something\usb
When I read this property like
<property file="${build_dir}/myvalues.properties" />
ant throws an exception, C:\mydir\build.xml:35:
java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
I understand that it interprets \u in usb as unicode char. how to over come
this?
I tried to use a filter to change "\" to "\\"
<filter token="\" value="\\"/>
<copy file="${build_dir}/myvalues.properties" filtering="true"
tofile="${build_dir}/myvalues1.properties" overwrite="true"> </copy>
It does not seem to work. What could be the problem ?
Bst rgds
Shreedhar
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional
commands, e-mail: user-help@ant.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org