Java examples for Internationalization:Unicode
Writing UTF-8 Encoded Data
import java.io.BufferedWriter; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.io.Writer; public class Main { public static void main(String[] argv) { try {/*w w w . j ava 2s .co m*/ Writer out = new BufferedWriter(new OutputStreamWriter( new FileOutputStream("outfilename"), "UTF8")); out.write("aString"); out.close(); } catch (UnsupportedEncodingException e) { } catch (IOException e) { } } }