How to write UTF8 text in Java


String fullPath="c:\temp\text.txt";
File curfile = new File(fullPath);

//write in UTF8 file format
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(curfile),"UTF8"));
out.write(content);

// Close the output stream
out.close();