You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Carlos Garcés <ca...@usa.net> on 2010/07/01 16:06:53 UTC
Remove nulll chars from file
Hi!
I'm trying to remove null chars of one fine generated with exec task,
this sin the simplified version:
<project name=MyProject" default="test" basedir=".">
<target name=est" >
<exec executable=Mycommand" failonerror="true" >
<redirector
error=rror.txt"
output=k.txt">
<outputfilterchain>
<tokenfilter>
<deletecharacters chars=0"/>
</tokenfilter>
</outputfilterchain>
</redirector>
</exec>
</target>
</project>
It works with \n, \r, \f, \t and \\
[http://ant.apache.org/manual/Types/filterchain.html#backslash] but not
with \0
There is other way to represent the null char on ant script?
Un saludo
Carlos Garcés
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Remove nulll chars from file
Posted by Carlos Garcés <ca...@usa.net>.
El 01/07/2010 16:44, Stefan Bodewig escribió:
> On 2010-07-01, Carlos Garcés wrote:
>
>
>> There is other way to represent the null char on ant script?
>>
> Unfortunately there isn't - and you can't even legally add a NUL
> character to any XML file either (for example� would be invalid).
>
> A custom filter (maybe a scriptfilter using JavaScript) would work, but
> I'm afraid you can't configure any of the configured filters to skip
> NULs.
>
> It may be a nice enhancement if Ant's "backslash interpretation"
> understood Java's unicode escapes so you could write \u0000.
>
> Stefan
>
>
The best option is change Ant to accept Unicode escapes, but is out my
scope.
The script filter just works, thanks for de tip.
<scriptfilter language="javascript">
self.setToken(self.getToken().replace('\0', ''));
</scriptfilter>
Carlos
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Remove nulll chars from file
Posted by Stefan Bodewig <bo...@apache.org>.
On 2010-07-01, Carlos Garcés wrote:
> There is other way to represent the null char on ant script?
Unfortunately there isn't - and you can't even legally add a NUL
character to any XML file either (for example � would be invalid).
A custom filter (maybe a scriptfilter using JavaScript) would work, but
I'm afraid you can't configure any of the configured filters to skip
NULs.
It may be a nice enhancement if Ant's "backslash interpretation"
understood Java's unicode escapes so you could write \u0000.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org