Saturday, February 23, 2013

How to encode the output files to UTF-8 format with Java

Default, I mean if you use FileWriter, the output file is ANSI format. If you want your output file with another encoding format, just use FileOutputStream.
Like this:

BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outpath),"UTF-8"));

For it can appoint the encoding format of the output files.

No comments:

Post a Comment