I improved your main method above to work for me:
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Scanner;
public class StringsConverter {
public static void main(String[] args) throws IOException {
Scanner fileScanner = new Scanner(new FileInputStream(args[0]), "utf-16");
Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(args[1])), "UTF8"));
writer.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n");
while (fileScanner.hasNextLine()) {
String line = fileScanner.nextLine();
if (line.contains("=")) {
String[] parts = line.split("=");
parts[0] = parts[0].trim()
.replace(" ", "_")
.replace("\\n", "_")
.replace("-", "_")
.replace("\"", "")
.replace(";", "")
.replace("'", "")
.replace("/", "")
.replace("(", "")
.replace(")", "")
.replace("?", "_Question");
parts[1] = parts[1].trim().substring(1, parts[1].length()-3);
parts[1] = parts[1].replace("'", "\\'");
String nextLine = "<string name=\"" + parts[0] + "\">" + parts[1].trim() + "</string>";
System.out.println(nextLine);
writer.append(nextLine + "\n");
}
}
fileScanner.close();
writer.append("</resources>");
writer.close();
}
}