如何在eclipse中阅读和写阿拉伯语 [英] how to read and write in arabic in eclipse

查看:178
本文介绍了如何在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);

}
}

但输出结果为: / p>

شیرین



Ø'یرین



任何帮助



提前感谢您的关注

解决方案

通过窗口>首选项>常规>工作区>文本文件编码,将工作区编码设置为UTF-8。这也会影响Eclipse控制台中stdout的编码。





然后你也可以替换 new PrintStream(System.out,true,UTF-8) System.out


I have written this code in eclipse to get some arabic words and then print them

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

    }
    }

but the output is this:

شیرین

شیرین

any help??

thanks in advance for your attention

解决方案

Just set workspace encoding to UTF-8 by Window > Preferences > General > Workspace > Text File Encoding. This also affects the encoding of the stdout in Eclipse console.

Then you can also just replace new PrintStream(System.out, true, "UTF-8") by System.out.

这篇关于如何在eclipse中阅读和写阿拉伯语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆