Read special characters in java with BufferedReade

2019-01-07 23:52发布

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

1条回答
萌系小妹纸
2楼-- · 2019-01-08 00:46

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();
查看更多
登录 后发表回答