10

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

Community
  • 1
  • 1
  • 1
    I'm voting to reopen this since it is marked as a duplicate of question that uses explicit charset, while accepted answer here suggests the problem was in not specifying the charset. Also, this Q was now used as a dup target. – Jiri Tousek Nov 16 '16 at 14:15

1 Answers1

32

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();
Guillaume Polet
  • 47,259
  • 4
  • 83
  • 117