[SOLVED] Android and Unicode
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
[SOLVED] Android and Unicode
I am working on my first Android App (as some of you know from my previous post )
My latest problem that I am stuck on is that Android is not displaying Hebrew text. I use encode and decoding RTF-8 to store and recover from a mySQL database and this works well on the desktop versions. But, for some reason it does not work on Android (same code). This leads me to wonder if I am missing some inclusion... but I cannot figure what it would be.
Any help from this amazing forum of kind geniuses would be most welcome.
Thank you!
>>> Problem solved -- see final post for instructions on using Hebrew for Android
My latest problem that I am stuck on is that Android is not displaying Hebrew text. I use encode and decoding RTF-8 to store and recover from a mySQL database and this works well on the desktop versions. But, for some reason it does not work on Android (same code). This leads me to wonder if I am missing some inclusion... but I cannot figure what it would be.
Any help from this amazing forum of kind geniuses would be most welcome.
Thank you!
>>> Problem solved -- see final post for instructions on using Hebrew for Android
Last edited by egolombek on Wed Jul 01, 2020 6:21 am, edited 1 time in total.
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Android and Unicode
I hope this doesn't send you to sleep, but to be fair I learnt a bit of Hebrew 40 years ago on a kibbutz near Ashqelon
and have done nothing further since then:
- -
The first field "I want to go to sleep" was filled in manually, using a Hebrew keyboard layout on a Macintosh computer.
The second field had text entered like this:
Sorry, I really am feeling sleepy, hence only one word, but you should get the point.
Now, I don't know all that much about databases, but I wonder how the encoding and decoding works . . .
BUT I don't know what you mean by "RTF - 8"
- I assume (?) that what is coming from the database is some sort of binary data, so wonder if you mean "UTF-8".
>>>>>>>>> viewtopic.php?t=29068
and have done nothing further since then:
- -
The first field "I want to go to sleep" was filled in manually, using a Hebrew keyboard layout on a Macintosh computer.
The second field had text entered like this:
Code: Select all
on mouseUp
put empty into fld "gg"
put numToCodePoint(0x05D0) after fld "gg"
put numToCodePoint(0x05E0) after fld "gg"
put numToCodePoint(0x05D9) after fld "gg"
end mouseUp
Now, I don't know all that much about databases, but I wonder how the encoding and decoding works . . .
BUT I don't know what you mean by "RTF - 8"
- I assume (?) that what is coming from the database is some sort of binary data, so wonder if you mean "UTF-8".
>>>>>>>>> viewtopic.php?t=29068
- Attachments
-
- Moshe.livecode.zip
- Here's the stack
- (994 Bytes) Downloaded 120 times
Re: Android and Unicode
Sleepy indeed -- cute!
Yes, not RTF-8, Should be UTF-8 -- a typo.
In any case, I read in a UTF-8 encoded message from a database and use textDecode to then place it in a field. It works on desktop but not on Android.
Yes, not RTF-8, Should be UTF-8 -- a typo.
In any case, I read in a UTF-8 encoded message from a database and use textDecode to then place it in a field. It works on desktop but not on Android.
function tidyD qID,colName
put revDatabaseColumnNamed (qID,colName) into tNam
put textDecode (tNam,"UTF-8") into tNam
return tNam
end tidyD
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Android and Unicode
There was a time when everything in the LiveCode documentation was badged as to which operating systems
it would work on . . .
I must say I wonder about Android and textDecode.
it would work on . . .
I must say I wonder about Android and textDecode.
-
- VIP Livecode Opensource Backer
- Posts: 7229
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Android and Unicode
When you say it doesn't work, what happens? Do you see text? If so, what's wrong with it?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Android and Unicode
I suspect the OP means that the data is not rendered as Hebrew text but something meaningless.
Might not be a bad idea to take a look over this way: viewforum.php?f=53
Might not be a bad idea to take a look over this way: viewforum.php?f=53
Re: Android and Unicode
Right, I get something meaningless, and strangely, only a few characters long when the original is several lines long.
I will try posting in the Android Deployment area -- thanks for the idea.
E
I will try posting in the Android Deployment area -- thanks for the idea.
E
-
- VIP Livecode Opensource Backer
- Posts: 7229
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Android and Unicode
I haven't ever needed to do this, but it looks like you will need a custom manifest file for the Android app. The manifest instructs Android to support RTL text.
<https://android.jlelse.eu/rtl-support-o ... 3f2df512e2>
That article covers several different aspects of RTL display, but you may only need the first couple that deal with text.
<https://android.jlelse.eu/rtl-support-o ... 3f2df512e2>
That article covers several different aspects of RTL display, but you may only need the first couple that deal with text.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Android and Unicode
First of all, thank you! I appreciate the ideas.
I am way out of my league when it comes to writing a manifest file. I didn't even know there was such a thing and would not know how to go about making one. I would try to figure it out, but really, from the article, that seems to be more about supporting RTL functionality. And while Hebrew is RTL, the problem seems to be before that with decoding. In other words, if it was an RTL issue, the text would appear, but backwards.
Still looking for ideas...
I am way out of my league when it comes to writing a manifest file. I didn't even know there was such a thing and would not know how to go about making one. I would try to figure it out, but really, from the article, that seems to be more about supporting RTL functionality. And while Hebrew is RTL, the problem seems to be before that with decoding. In other words, if it was an RTL issue, the text would appear, but backwards.
Still looking for ideas...
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Android and Unicode
At the risk of insulting you:Still looking for ideas...
Have you tried other encodings (UTF-16)?
Is it possible that you could supply 'us' here with a line of the binary data (to 'play' with)?
Re: Android and Unicode
I had an app (desktop based) the client used for captioning and headline tickers on a TV station in Iran. There would be lines of text in English in text files that translators would type in the Farsi version. This worked perfectly on screen but highlighted the fact that text is not always the same on different systems and even different applications on the same system. Specifically it was necessary to include a byte order marker, so that the big-endian or little-endian decision was made for the target without the target having a chance to get the codepoint bytes twisted around.
So not sure if it's helpful, but could be another area to check.
Some sample data would indeed be good if possible.
So not sure if it's helpful, but could be another area to check.
Some sample data would indeed be good if possible.
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Android and Unicode
Hmm . . . it would be interesting to see what an Android build of that does.
- Attachments
-
- Avram.livecode.zip
- Here's the stack.
- (1.46 KiB) Downloaded 130 times
Re: Android and Unicode
FYI: I deleted the double posting in the ANDROID forum!
Re: Android and Unicode
So, Richmond62... I appreciate your efforts!
Unfortunately, putting the stack you sent on Android only highlighted the problem. For one thing, you cannot see the Hebrew typing in the top field. Still, I typed blindly אני אוהב גלידה (I like ice cream). But most troubling... none of the decodings put it back together:
Help!!!!
Unfortunately, putting the stack you sent on Android only highlighted the problem. For one thing, you cannot see the Hebrew typing in the top field. Still, I typed blindly אני אוהב גלידה (I like ice cream). But most troubling... none of the decodings put it back together:
Help!!!!
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Android and Unicode
How about setting the fontLanguage to Hebrew?For one thing, you cannot see the Hebrew typing in the top field.
Then you can ensure that when a stack is exported to Android it will select a Hebrew font rather than the generic nonsense.