我有这个打印阿拉伯语句子和扫描阿拉伯语字符的简单代码。
让我发疯的是它在 cmd 中正确打印,但从不扫描字符它以
的形式扫描阿拉伯字符��� �����
我尝试了一切:Scanner(System.in,"UTF-8")
, Scanner(System.in,"UTF8");
请帮忙
public static void main(String[] args) {
Scanner in2 = new Scanner(System.in,"UTF-8");
System.out.printf(" ادخل جملة السؤال \n");
String s = in2.nextLine();
System.out.printf(""+s+"");
// TODO code application logic here
} Scanner in2 = new Scanner(System.in,"UTF-8");
System.out.printf(" ادخل جملة السؤال \n");
String s = in2.nextLine();
System.out.printf(""+s+"");
输出:
ادخل جملة السؤال هذا تلميذ ��� �����
BUILD SUCCESSFUL (total time: 11 seconds)
最佳答案
我在 netbeans 8 和 windows 7 上也有同样的问题
要解决这个问题,请这样做
打开
C:\Program Files\NetBeans 8.0\etc\netbeans.conf
你会发现这个
netbeans_default_options="..."
在它的开头添加这段代码,所以最后它看起来像那样
netbeans_default_options="-J-Dfile.encoding=UTF-8 -J-client ..."
然后重启netbeans
检查这个屏幕截图
关于java - 扫描阿拉伯字符 netbeans 8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29076145/