Not possible to specify encoding for a FileWriter object.
The documentation states that FileWriter is a convenient class depending on the underlying platform.
The easiest solution is to use an OutputStreamWriter. Something as follows, in my case I am exporting to CSVWriter:
FileOutputStream fos = new FileOutputStream(new File(fileName));
OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
CSVWriter writer = new CSVWriter(osw, CSV_DELIMITER);
Tuesday, August 4, 2009
Subscribe to:
Post Comments (Atom)
Thanks...Something I was looking for!
ReplyDeleteeverything fine but it not working
ReplyDelete