Saturday, July 31, 2010

Bellybutton Ring Monster Logo

Ant Copy task filtering and encoding

An entry from the "small mistake, big impact": Resource Properties -files for a web application with a Ant script from the project folders in the appropriate folder web application copied. Some properties files it contains accents were in the browser sometimes (depending on the application server and depending on the computer where the Web application was built) misrepresented.

cause of the problem was a copy task that the Copied file is not 1:1, but with a filter set has replaced certain token. Depending on the system settings were then in the web application umlauts (or generally special characters), which could in the browser to display properly - or not. is

The solution of the problem, explicitly specify in filter-copy coding tasks, so that the system default encoding is used (the documentary mentioned this at the end of the document). In properties files ISO-Latin-1 (ISO-8859-1) is usually a first, good choice (provided that the entire web application is not designed to UTF):
 \u0026lt;copy 
todir = "$ { webapp} / WEB-INF/classes "
file = "$ {src} / MyResources.properties"
encoding = "ISO-8859-1"
overwrite = "true">

\u0026lt;filterset>
\u0026lt;filter token = "compiletime" value = "$ {DSTAMP} - $ {tstamp}" />
\u0026lt;/ filter set is Painted>

\u0026lt;/ copy>
the bow probably by copy & paste, from a fileset - without filtering, thus without the need to specify a character encoding - a filter set was.

0 comments:

Post a Comment