a little unicode help
cmsheffield at me.com
Tue Oct 30 11:32:16 CDT 2012
Here's a selection of my code. It really is quite simple.
I first retrieve the text from the native text input control:
put mobileControlGet(myInputID,"unicodeText") into tUserName
This user name then gets saved to a SQLite database. Then the user name is placed in a LiveCode field using:
set the unicodeText of field "name" to tUserName
This works if I use the Russian keyboard to enter text (I've just been using Russian, btw; I imagine the same problem would occur with any language). However, if I enter a name using the English keyboard, it doesn't work. The LiveCode is either empty or, in some cases, it will display the first character only.
I think the breakdown is in saving to the database. It seems like SQLite's unicode conversion may not be working correctly. But I tried a uniDecode() when saving to the db, and a uniEncode when retrieving, and that didn't seem to make any difference. Have you ever dealt with this before? Any other thoughts?
Thanks for you help,
On Oct 30, 2012, at 9:57 AM, Mark Schonewille <m.schonewille at economy-x-talk.com> wrote:
> Post your script to show the encoding. You should encode Russian and English text in exactly the same way. If it works for Russian, then it works for English.
> If it only disaplays the first character, then there is probable a NULL character somewhere, which indicates double-byte encoding, while your scripts treats it as single-byte encoding. Just a hunch.
> Best regards,
> Mark Schonewille
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
> KvK: 50277553
> Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other colour spaces. http://www.color-converter.com
> On 30 okt 2012, at 16:51, Chris Sheffield wrote:
>> Thanks for the quick reply, Mark.
>> I've tried treating all text as unicode, but the characters from the English keyboard still don't work right. But maybe my problem is in the conversion. So I'm retrieving the unicodeText property of the native text field. Then I'm using the unicodeText property of a LiveCode field to display the entered text. And in that field, I either have garbled text, or it just gets chopped off, only displaying maybe the first character. There is something goofy, but I think it's probably just my lack of knowledge of how this should work.
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode