我已經寫在eclipse這個代碼得到一些阿拉伯字,然後打印出來如何閱讀和阿拉伯語寫在Eclipse
public class getString {
public static void main(String[] args) throws Exception {
PrintStream out = new PrintStream(System.out, true, "UTF-8");
Reader r = new InputStreamReader(System.in, "UTF-8");
char[] str ;
str= new char[10];
r.read(str);
out.println(str);
}
}
但輸出是這樣的:
شیرین
Ø'یرین
任何幫助?
在此先感謝您的關注
是不是'str的[0]'只是一個角色?你如何獲得不止一個角色? –
修復Eclipse中的控制檯編碼爲UTF-8。如果你在Windows上,它不會起作用。 – bmargulies
如果從System.in讀取和寫入到System.out沒有試圖改變編碼會發生什麼? –