-1
我使用Java將文件中的內容讀取到字符串中。但字符串不能顯示一些字符,如ćşę。無法顯示從文件中讀取的某些字符
這裏是我的代碼:
FileInputStream in = new FileInputStream(f);
BufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8"));
PrintStream out = new PrintStream(System.out, false, "UTF-8");
while(true) {
String line = br.readLine();
if(line == null)
break;
out.println(line);
}
我怎樣才能解決這個問題?
試試這個線程..http://stackoverflow.com/questions/13877187/read-special-characters-from-a-file-and-write-in-another-file-using-java – Mohit 2014-09-23 12:20:00
它可能會來從您的控制檯不正確顯示這些字符。嘗試在文件中寫入並檢查它是否正確。 – 2014-09-23 12:20:03
你得到了什麼錯誤 – vikeng21 2014-09-23 12:21:07