I have a file with Chinese characters text inside, I want to copy those text over to another file. But the file output messes with the chinese characters. Notice that in my code I am using "UTF8" as my encoding already:
BufferedReader br = new BufferedReader(new FileReader(inputXml));
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
sb.append(line);
sb.append("\n");
line = br.readLine();
}
String everythingUpdate = sb.toString();
Writer out = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(outputXml), "UTF8"));
out.write("");
out.write(everythingUpdate);
out.flush();
out.close();