scan in arabic characters netbeans 8

2019-03-01 05:18发布

I have this simple code that prints Arabic sentence and scan arabic characters .

what is drivingme crazy is that it prints in cmd right , but never scan characters it scans arabic characters in form of

��� �����

I tried everything: Scanner(System.in,"UTF-8"), Scanner(System.in,"UTF8");

please help

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+"");

output :

ادخل جملة السؤال هذا تلميذ ��� �����

BUILD SUCCESSFUL (total time: 11 seconds)

3条回答
▲ chillily
2楼-- · 2019-03-01 05:59

Don't worry about that, it is the IDE's problem. Most IDEs console window don't support other that ASCII, but In real life Swing, this will appear as usual.

查看更多
家丑人穷心不美
3楼-- · 2019-03-01 06:00

i have the same problem with netbeans 8 and windows 7
to fix this please do that
open

C:\Program Files\NetBeans 8.0\etc\netbeans.conf

you will find this

netbeans_default_options="..."

add this code at the begining of it so at the end it will look like that

netbeans_default_options="-J-Dfile.encoding=UTF-8 -J-client ..."

and restart the netbeans

check this screen shot enter image description here

查看更多
Lonely孤独者°
4楼-- · 2019-03-01 06:07

I faced this issue in Windows Server 2016.

Solution: 1. Go to Control Panel -> Region. 2. Open Administrative tab. 3. Click “Change System Local” to Arabic. 4. Restart the server.

查看更多
登录 后发表回答