Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read special characters in java with BufferedReader [duplicate]

Possible Duplicate:
Read/write .txt file with special characters

Im reading a file but I dont know how to read the accents and special caracters, here is mo code for read I read I have to add a different codification but i dont know how to doit

File file = new File("C://fichero.csv");

BufferedReader bufRdr  = new BufferedReader(new FileReader(file));
String line = null;

    line = bufRdr.readLine();

Thanks

like image 442
Jonathan Raul Tapia Lopez Avatar asked Feb 14 '12 17:02

Jonathan Raul Tapia Lopez


1 Answers

Try with the following:

File file = new File("C://fichero.csv");

BufferedReader bufRdr  = new BufferedReader(
    new InputStreamReader(new FileInputStream(file),"ISO-8859-1"));
String line = null;

line = bufRdr.readLine();
like image 139
Guillaume Polet Avatar answered Oct 04 '22 11:10

Guillaume Polet