I received a bug report from my customers about my android application in Lenovo devices.
I noticed when I set the locale of app to a RTL language like Persian or change the language of Android OS to Persian, the setTex() method of EditTexts or Textviews inserts two extra characters at the beginning and the end of the original string.
For example:
String myString1 = "original string";
int length1 = myString1.length(); // length1 is 15
myEditText.setText(myString1);
String myString2 = myEditText.getText().toString();
int length2 = myString2.length(); // length2 is 17
This problem occurs only on Lenovo devices. The setText() method adds LEFT-TO-RIGHT OVERRIDE (U+202D) at the beginning and POP DIRECTIONAL FORMATTING (U+202C)at the end of my string in RTL mode.
This causes big problems in my application. I have lots of setText() methods.
Is there any short solution for solving this this problem?
Device info: Lenovo Tablet TB-8504X, Android 7.1.1
Update:
Is the problem with Android OS? Can I find any fix for the device?