You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ian Kiigan <ia...@kiigan.com> on 2002/11/07 13:50:12 UTC

Using the Ant "filter" task with unicode files

Re: Problem using Ant filter task and accented characters
    etc in unicode files

Hi there Ant Users,

Quick question:

I'm using Ant 1.5 and doing something like this:

<copy todir="${src.filtered}">
  <fileset dir="${src.dir}">
    <include name="**/*.java"/>
  </filterset>
  <filterset begintoken="%%" endtoken="%%">
    <filtersfile="${gametext.properties}"/>
  </filterset>
</copy>

And in the source of my application I do stuff like:

...
String titleStr = "%%mainmenu.title%%";
...

The idea being to replace tokens (as defined in a properties file)
in the source code of my application. It all works swimmingly for
English languages versions of my application, but when I use
accented characters for languages such as French or Italian, I
notice that the characters are NOT SUBSTITUTED CORRECTLY by the
filter task.

For example, a character such as "รน" (a lower case "u" with a
grav accent) is substituted as something else entirely (what looks
like "?" or similar, a capital A with a squiggle of some kind over it).

I've been using text editors that support Unicode (such as GVIM) so
I'd expected all of this to work fine. However it doesn't. Is there a
problem with the implementation of the filter task perhaps? Has anyone
else used the filter task for non-English unicode strings?

Thanks for any advice you might give,

Ian Kiigan



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Using the Ant "filter" task with unicode files

Posted by Ian Kiigan <ia...@kiigan.com>.
Thanks for the advice Stefan, much appreciated.

I don't suppose anyone has a custom Ant <copy> task
that will allow filtering for any unicode text file?

Or alternatively what parameters the "encoding" param
(for <replace>) takes? I notice <replace> doesn't allow setting
the start and end filter token, it has to be "@" which is a
shame.

Ian

Ian Kiigan
ian@kiigan.com

> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@apache.org]
> Sent: 07 November 2002 14:36
> To: ant-user@jakarta.apache.org
> Subject: Re: Using the Ant "filter" task with unicode files
>
>
> On Thu, 7 Nov 2002, Ian Kiigan <ia...@kiigan.com> wrote:
>
> > Re: Problem using Ant filter task and accented characters
> >     etc in unicode files
>
> <copy> assumes that all files are in your platform's default encoding.
> If you use a different encoding, this are bound to break.
>
> Maybe you can use <replace> instead of filtered copy, you can
> explicitly specify the encoding for replace.
>
> Stefan
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Using the Ant "filter" task with unicode files

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 7 Nov 2002, Ian Kiigan <ia...@kiigan.com> wrote:

> Re: Problem using Ant filter task and accented characters
>     etc in unicode files

<copy> assumes that all files are in your platform's default encoding.
If you use a different encoding, this are bound to break.

Maybe you can use <replace> instead of filtered copy, you can
explicitly specify the encoding for replace.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>