Unicode data into Rev fields

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
larryh
Posts: 32
Joined: Sat Mar 22, 2008 6:02 pm

Unicode data into Rev fields

Post by larryh » Tue Apr 01, 2008 8:46 pm

Hi,
I have a SQLite database with data encoded in UTF8. I can't seem to figure out a way to get the data to display in Rev fields properly. I have been using the Database Query Builder, and then populate fields using the Object Inspector ... Database properties. I have tried setting the Text Formatting on the field properties to a unicode font, with Unicode, with UTF8, etc. and I seem to either get ANSI characters or Chinese characters showing up. I can't get the special characters in the data to appear properly in the field.

Any suggestions? I have also tried reencoding the SQLite database as UTF16LE and the same problems occur.

Thanks,

Larry

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Wed Apr 02, 2008 12:40 am

Larry,

this should work:

set the unicodeText of fld x to uniencode(myVar,UTF8)

MyVar is a variable containing the UTF8 string from your database.

Note that the endian of the unicode string needs to be the same as the endian of your processor. Intel: little endian, PPC: big endian.

If the endian is not right, you can switch the bytes in the variable by a repeat loop. Just put each second byte before its preceding byte. This shouldn't apply to UTF8, though.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

larryh
Posts: 32
Joined: Sat Mar 22, 2008 6:02 pm

Post by larryh » Thu Apr 03, 2008 6:32 pm

Thanks Mark. Yes, this does work : )

I was hoping to be able to use the built-in database properties of the field that allow you to directly link to a Query built in the Database Query builder but it looks like I need to load the data from the query into variables, and then into fields.

Having lots of fun experimenting with Rev!

Larry

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Thu Apr 03, 2008 8:33 pm

You may want to add a feature request to the Quality Center, so they can add an enhancement to the Rev database library and automated query system.
http://www.quality.runrev.com

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Post Reply