Read special characters in java with BufferedReader [duplicate]

江枫思渺然 提交于 2019-11-26 09:55:25

问题


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:


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();


来源:https://stackoverflow.com/questions/9281629/read-special-characters-in-java-with-bufferedreader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!