某些阿拉伯文本显示不正确,而其他阿拉伯文本显示正常?

2023-12-22

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..
enter image description here

Here is the code of the app:
enter image description here

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>

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


如果将 setText 排列起来,第二个比第一个长,这意味着它几乎肯定包含看起来像空格但实际上是其他字符的字符;尝试对字符串进行 UTF-8 编码并逐块进行比较。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

某些阿拉伯文本显示不正确,而其他阿拉伯文本显示正常? 的相关文章

随机推荐