I think Android bidi analysis algorithm has some disadvantages. Unicode has two invisible, highly directional characters that can help with these problems:
- U + 200E - sign from left to right
- U + 200F - sign from right to left
For a digit order problem, try placing the characters from left to right (U + 200E) on both sides of the digital sequence.
Unicode also has the following bidi formatting codes:
- U + 202A - insert from left to right
- U + 202B - insert from right to left
- U + 202C - formatting the pop direction (cancels the previous attachment or redefinition)
- U + 202D - redefinition from left to right
- U + 202E - redefinition from right to left
For a problem with English fragments in Hebrew text, this can be as simple as putting a character from right to left in front of English. (The Android algorithm may be under the impression that the paragraph is left to right, since the first characters are English.) If this does not work, perhaps try to surround the selected text with some combination of formatting codes. (I would try nesting from left to right, followed by formatting the pop direction). I would also try to insert left to left everything that combined with selective explicit attachments from right to left.)
The way they should influence the layout of the text is determined by the bidirectional Unicode Unicode Standard Annex # 9 algorithm. However, if the Android implementation is broken (and I suspect it is), the best thing you can do is try a test error until you get the correct idea. Good luck.
EDIT
As for the code, here is an example of how this can be done in Java:
String text = "ืืจืกื \u200e2.100\u200e ืืืื ื";
In XML, it could be:
<string name="update_available">ืืจืกื ‎2.100‎ ืืืื ื</string>
source share