a little unicode help
m.schonewille at economy-x-talk.com
Tue Oct 30 12:44:42 EDT 2012
Are you 1) first retrieving the data from the native text field as unicode, then saving the data to SQLite, then reading it from SQLite and finally setting the text of the LiveCode field or 2) just retrieving the data from the native text field and immediately setting the unicodeText of the LiveCode field while also at some point saving the data to SQLite without affecting any of the variables containing the data?
If you are reading data from SQLite, then SQLite probably expects UTF8 while you're saving UTF16. Before you save data to SQLite, convert it:
put uniDecode(tUserName,"UTF8") into tUserName
and after you retreive it from SQLite encode it:
put uniEncode(tUserName,"UTF8") into tUserName
Economy-x-Talk Consulting and Software Engineering
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 17:32, Chris Sheffield wrote:
> 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,
More information about the Use-livecode