某些阿拉伯文字被错误地显示,而其他阿拉伯文字被正常显示? [英] Certain Arabic text gets incorrectly shown while other Arabic text gets showed normally?

查看:212
本文介绍了某些阿拉伯文字被错误地显示,而其他阿拉伯文字被正常显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发展在它阿拉伯文字。我的手机支持阿拉伯语,使文本得到正确显示。一个应用程序的奇怪的问题是:如果我复制我从A.TXT文件需要一个阿拉伯文字,并把它变成一个EditText时,显示的EditText怪异字符,但如果我手动编写相同的文本(不要复制粘贴),文本被正常显示!!结果
这里是图片展示了我的意思,第一个是的EditText我手动写的文字,第二个是从.txt文件复制我,粘贴文本..结果

I'm developing an app with Arabic text in it.. My phone supports Arabic so the text gets displayed correctly.. the weird problem is that: if I copy an Arabic text that i want from a.txt file and put it into an EditText, the EditText displays weird characters, but if I write the SAME text manually (not copy-paste), the text gets displayed normally!!
Here is a picture showing what I mean, the first EditText is the text I wrote manually, and the second is the text I copy-pasted from the .txt file..

下面是应用程序的code:结果

Here is the code of the app:

XML文件:

  <?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" android:orientation="vertical">
    <EditText android:text="EditText" android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content"></EditText>
    <EditText android:text="EditText" android:id="@+id/editText2" android:layout_width="wrap_content" android:layout_height="wrap_content"></EditText>
</LinearLayout>

我希望你明白我的意思,因为它不是很容易解释这个奇怪的(愚蠢)的问题。谢谢你。

I hope you get what I mean, since it wasnt easy to explain this weird (stupid) problem. Thanks.

推荐答案

如果您线下的setText起来,第二个比第一个,这意味着它几乎肯定包含了像空间,但实际上是别的字符;试试UTF-8编码字符串,并以块比较它们的块。

If you line the setText up, the second is longer than the first, which means it almost certainly contains characters that look like spaces but are actually something else; try UTF-8 encoding the string and comparing them block by block.

这篇关于某些阿拉伯文字被错误地显示,而其他阿拉伯文字被正常显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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