从 .txt 文件中获取阿拉伯语文本? [英] Getting Arabic text from .txt file?

查看:32
本文介绍了从 .txt 文件中获取阿拉伯语文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我想在一个简单的 EditText 中显示一个 txt 文件中的阿拉伯语文本,虽然当我这样做时,我得到的是:http://i55.tinypic.com/66g09z.png

Hey, I have Arabic text in a txt file that I would like to show in a simple EditText, Though when I do that here is what I get: http://i55.tinypic.com/66g09z.png

这是我用来从 .txt 文件中获取文本的代码:

Here is the code I use to get the text from the .txt file:

    txt1 =(EditText) findViewById(R.id.EditText01); 

    try{

           File f = new File(Environment.getExternalStorageDirectory()+"/1.txt");
           FileInputStream fileIS = new FileInputStream(f);          
           BufferedReader buf = new BufferedReader(new InputStreamReader(fileIS));           
           String readString = new String();             

           //just reading each line
           while((readString = buf.readLine())!= null){          
               txt1.setText(txt1.getText().toString()+readString);                
           }             
        } catch (FileNotFoundException e) {

           e.printStackTrace();

        } catch (IOException e){

           e.printStackTrace();          
        }

}

如何在 EditText 中输入正确的阿拉伯字母?谢谢

How can I get proper Arabic letters into the EditText? Thanks

推荐答案

您运行的是什么版本的 android?在 2.3 版本之前,Android 不支持阿拉伯语语言环境.您可以在相应的 SDK 页面上找到有关支持的语言环境的更多信息.例如,SDK 2.3 支持的语言环境列表是here.

What version of android do you run? Android has no support for Arabic locales up until 2.3 version. You can find more info about locales supported on corresponding SDK pages. For example, list of SDK 2.3 supported locales is here.

这篇关于从 .txt 文件中获取阿拉伯语文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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