As requested, and since you are using io shared resources, here is an example code (error checking in the wind):
import java.io.File; import java.io.IOException; import org.apache.commons.io.FileUtils; public class Main { public static void main(String[] args) throws IOException { String filename = args[0]; File file = new File(filename); String content = FileUtils.readFileToString(file, "ISO8859_1"); FileUtils.write(file, content, "UTF-8"); } }
daveb
source share