文本视图显示了阿拉伯语字符作为问号" ?????" [英] Text view displays Arabic characters as question marks "?????"
问题描述
我工作的一个Android应用程序显示一个 textviews
混合阿拉伯语和英语单词;
这是我的Java类中写为问号应用显示了阿拉伯语的文字?????这里是一个截图:
的code:
如果(tCat.equals(StandardT _)){
服务热线=操作/خدماتعامة
}
tv.setText(服务热线);
我曾尝试:
-
解码的Android 字符
没有它不是同样的问题,答案没有帮助。 -
<一个href=\"http://stackoverflow.com/questions/7962704/how-to-support-arabic-text-in-android/7962813#7962813\">How支持阿拉伯文字在Android中?
我使用的是支持阿拉伯语一个新版本,我也试过了答案,如添加波斯语
类或使用ArabicUtilities
班但没有工作醚 -
我也试图EN code字符串为UTF-8
尝试{
服务热线= URLEn coder.en code(服务热线,UTF-8);}
赶上(UnsupportedEncodingException五){
e.printStackTrace();
}
和没有工作!
<醇开始=4>所以我有点坚持在这里,任何想法?
编辑:的
我关闭了Android的工作室,并重新打开应用程序的一切,我的Java类里面写的文字后转身问号!即使我试着写一遍吧,一旦我关闭项目并重新打开它,它显示了阿拉伯文字作为Java类中的问号连我运行应用程序之前,这实在是尴尬!
您需要设置文件的文件编码的包含阿拉伯文文本为 UTF-8
这是你如何从里面更改文件编码的 Android的工作室。
I'm working on an android app that displays a textviews
with mixed Arabic and English words;
the app displays Arabic text that I wrote inside Java classes as question marks ????? here is a screenshot:
The Code:
if(tCat.equals("StandardT_")){
serviceLine="Operations / خدمات عامة";
}
tv.setText(serviceLine);
what I have tried:
Decoding characters in android and no its not the same question and the answers didn't help.
How to support Arabic text in Android? I'm using a new version that supports Arabic and I also tried the answer like adding
Farsi
Class or usingArabicUtilities
classes but that didn't work etherI also tried to encode String into utf-8
try { serviceLine= URLEncoder.encode(serviceLine, "utf-8");} catch(UnsupportedEncodingException e){ e.printStackTrace(); }
and that didn't work!
- also tried using multiple fonts but not a single Typeface solved the problem.
So I'm kind of stuck here, any ideas?
Edit: After I closed android studio and reopened the app all of the text that I wrote inside the Java classes turned to question marks! Even though I tried to write it again, once I closed the project and reopened it, it displays the Arabic text as question marks inside the Java classes before even I run the application and this is really awkward!
You need to set the file encoding of the file that contains the arabic text to UTF-8.
This is how you change file encoding from inside Android-Studio.
这篇关于文本视图显示了阿拉伯语字符作为问号&QUOT; ?????&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!