问题
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