Java OutputStreamWriter create with Charset
import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.nio.charset.Charset; public class Main { public static void main(String[] args)throws Exception { String text = ""; OutputStreamWriter writer = null; FileOutputStream fos = new FileOutputStream("helloworld.utf8.txt"); writer = new OutputStreamWriter(fos, Charset.forName("UTF-8")); writer.write(text);//w w w. ja va 2 s . c om writer.close(); } }