Android. Problem with arabic keyboard - android

I make arabic virtual keyboard, and I have a problem.
If you write only arabic characters - all works (written right to left). But the numbers and punctuation marks are written to the right of the previous word. Although should be written to the left of the word. For example:
You write:
word_2011 where '_' is space
Must be:
'2011_drow' (look right to left, numbers read left to right)
but is:
'_drow2011'
Now more interesting. If you write 'NOW' you get
'_drow201WON1' (must be 'WON2011_drow')
This is Android problem? Or is it possible to solve it?

This is due to the way Android mis-implements bidi (bi-directional) logic.
You will also have issues with arabic letters not displaying the mid and start letters correctly.
To work around the space problem you could try to insert a direction character between them see: http://en.wikipedia.org/wiki/Unicode_control_characters. This will work, but will get a square displayed instead of a space in some phones.

Related

Replacing Non-Breaking Space Android not working

I need to replace \u00A0, but it doesn't work with (found out which character it is by copying it to a text to unicode converter)
string.replace("\u00A0", " ");
It also doesn't work with copying the exakt character from the log into Android Studio. I unfortunately can't paste this character here, it gets converted to a normal white space.
I also tried many other solutions which should potentially remove this character, none of them actually worked.
My intention is to compare two phone numbers (looking like this: +49 176 34535...), one with non-breaking spaces and one with normal whitespaces from the keyboard. Non-breaking spaces result of reading the phone number from a notification.
Does someone have an idea how to solve my problem?

Zero-width space with special characters

Interesting problem here, wondering if anyone has come across it.
I am building an Android app that has some special characters as text (mainly Japanese characters) and our designers want some soft returns strategically placed, incase the text needs to wrap due to width limitations on smaller devices.
The problem is that since the text is essentially Japanese, there are no spaces between words.
I know we can use \u200b as a zero-width space resulting in a string like this:
abcdef\u200bghijklmnop
appearing like this when there is enough room:
abcdefghijklmnop
and like this if it needs to wrap:
abcdef
ghijklmnop
The problem is that if instead of standard English characters, we use Japanese characters it doesn't seem to work. We don't get soft line breaks at all. It instead always breaks right where it runs out of space regardless of where we put the \u200b
ヘルプヘルプ\u200bヘルプヘルプ
results in:
ヘルプヘルプヘルプヘ
ルプ
Has anyone dealt with this before or have any ideas on how to solve this?

How to make slightly-modified Android keyboard

I have a sort-of Scrabble-dictionary lookup app in mind (already have Java version working in Windows) in which the user can:
simply look up a word (e.g., hacker)
or
use wildcards (#, *, ?) to define a pattern for words he might be able to make
E.g.:
fixed length word: h???er (6 letters)
varying length word: h*er (3 to max number of letters)
fixed length word with no repeated letters: h###er (6 letters)
and unlimited combinations of ? and *: h?*er (4 to max number of letters)
I'd hate to have to make my own keypad and worry about positioning the cursor and editing text fields. It would be great if I could remap an existing keypad to look something like this:
Is it possible for an Android developer to change the face and action of a key on one of the standard keyboards? Or is there a keyboard template for just such purpose?
EDIT
Of course I mean to remap during execution of my app, which, the more I think about it, is probably impossible, except how does the "enter" key morph into "go" and "next" and stuff like that?
Likely I'll just have to settle for this setup with a standard qwerty pad and a few buttons, though I'd still have to worry about inserting the 3 wildcards into the text fields:
Might not be so bad. Agree?

Android special characters converted to images in WebView?

Special characters such as
📂 ★ ✉
Are being replaced with images in the Android OS. As you can see, this seems to affect native TextViews (see screenshot).
My problem is they are also affecting the HTML I am loading through my app via WebView. The main problem is stars of different colors are all showing up as the same gray star. And other than that, you can imagine the visual inconsistency problems that arise.
If you load this page on Chrome for Android, the characters don't load at all. But if you copy the question and paste it into a plain text program such as ColorNote, you will see what I'm experiencing.
Is there a way to get my own WebView or even my entire app to use the font-family, rather than an image?
A wild guess, since I've only heard about this happening on iOS now.
How can I disable the unicode black telephone from being rendered as a red phone on iOS Mail app?
I need help getting a normal looking unicode down arrow in a UILabel like this ⬇
Unicode has this nifty thing that's called "Variation selectors", which can be used, among others, to select a variant shape of a letter, or to select whether a glyph is to be rendered as a black-and-white standard glyph, or as a colourful picture.
This variants are characters \uFE00 to \uFE0F. In case of emoji, \uFE0E means "render the previous character as a black-and-white glyph", and \uFE0F means "try to draw the previous character as a colourful picture".
So in your case, add \uFE0E after the character.

Android Hebrew (RTL) Integration

I'm working on a relatively simple Android app. I want it to have an English version as well as a Hebrew version. (RTL Right to Left Alignment)
I have manually change the alignment to right in layout xml file. When a sentence contains digits (in the middle of it), the digits appear in a mirror view:
29 appears as 92, 21:45 appears as 54:12 and 2,000 appears as 000,2.
Also, when a sentence starts with digits or English characters, they get thrown to the end of the sentence messing it all up.
I think for android version 4.0.3 it supports Hebrew. I have check that in emulator.
So for older versions is there correct way to implement Hebrew?
Please help.
I think that Android's bidi analysis algorithm has some flaws. Unicode has two invisible, strongly directional characters that might help with these problems:
U+200E - left-to-right mark
U+200F - right-to-left mark
For the digit order problem, try putting left-to-right marks (U+200E) on both sides of the digit sequence.
Unicode also has the following bidi formatting codes:
U+202A - left-to-right embedding
U+202B - right-to-left embedding
U+202C - pop directional formatting (cancels the previous embedding or override)
U+202D - left-to-right override
U+202E - right-to-left override
For the problem with English fragments in Hebrew text, it might be as simple as putting a right-to-left mark before the English. (Android's algorithm may be under the impression that the paragraph is left-to-right since the first characters are English.) If that doesn't work, perhaps try surrounding selected text with some combination of formatting codes. (I'd try left-to-right embedding followed by pop directional formatting. I'd also try right-to-left embedding around everything combined with selective explicit right-to-left embeddings.)
The way these are supposed to affect text layout are defined by the Unicode Bidirectional Algorithm Unicode Standard Annex #9. However, if Android's implementation is broken (and I suspect it is), the best you can do is trial-and-error until you get things looking right. Good luck.
EDIT
As far as code is concerned, here's an example of how it might be done in Java:
String text = "גרסה \u200e2.100\u200e זמינה";
In XML, it might be:
<string name="update_available">גרסה ‎2.100‎ זמינה</string>
here is an example from my hebrew string xml, Thanks to Ted Hopp's answer:
you need to add '\u200e' before the char that causes you the problem:
<string name="basic_text1">המר על תוצאת המשחק\u200e:</string>
and the result will be:
:המר על תוצאת המשחק

Categories

Resources