Please have a look at the following code
import java.io.*;
public class CSVConverter
{
private File csvFile;
private BufferedReader reader;
pri
To read a text file with a specific encoding you can use a FileInputStream
in conjunction with a InputStreamReader
. The right Java encoding for Windows ANSI is Cp1252
.
reader = new BufferedReader(new InputStreamReader(new FileInputStream(csvFile), "Cp1252"));
To write a text file with a specific character encoding you can use a FileOutputStream
together with a OutputStreamWriter
.
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "Cp1252"));
The classes InputStreamReader
and OutputStreamWriter
translate between byte oriented streams and text with a specific character encoding.