Ant Task for Encoding Text Files – Reencode 0.1 Launched
Join the DZone community and get the full member experience.
Join For Free
reencode is a small set of tools—aimed at developers in the java
ecosystem—that help with changing the character encoding of text files.
initially, the tools consist of an api (if you can call one class an api
) and, far more useful, an ant task. a
gradle
task will be following shortly.
the code is licensed under the apache license v2.0 and is hosted on github here . you can obtain the .jar file for version 0.1 here .
using the ant task is simple. detailed instructions are on the projects wiki but here is a quick example:
<?xml version="1.0" encoding="utf-8"?> <project name="sample" default="default"> <taskdef name="reencode" classname="org.reencode.tools.ant.charencodingconverter" classpath="reencode-0.1.jar" /> <target name="default"> <reencode inputencoding="utf-8" outputencoding="iso-8859-1" todir="out"> <fileset dir="samples" includes=".txt"/> </reencode> </target> </project>
the sample above shows how you can re-encode all the .txt files in the samples directory from their current, known encoding utf-8 to iso-8859-1. the re-encoded files are dumped into the directory named out.
if you put these tools to use, please don’t hesitate to provide feedback or ask questions as comments below or on github . pull requests are welcome too! enjoy.
Published at DZone with permission of Nick Watts, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
Competing Consumers With Spring Boot and Hazelcast
-
How To Become a 10x Dev: An Essential Guide
-
AI Technology Is Drastically Disrupting the Background Screening Industry
-
Does the OCP Exam Still Make Sense?
Comments