SQLite - International Characters

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

SQLite - International Characters

Post by andyh1234 » Thu Nov 01, 2007 6:17 pm

Hi,

Is there any way to create a field in a table in SQLite that will accept international characters, they always seem to get messed up when I add them.

Im creating the table as follows - am I doing something wrong?

get revOpenDatabase ("sqlite",dbPath,,,,,)
put it into gdbID
revExecuteSQL gDBId, "CREATE TABLE Progress(" & \
"Id INTEGER PRIMARY KEY AUTOINCREMENT" & comma & \
"user TEXT NULL" & comma & \
"field1 TEXT NULL" & comma & \
"field2 TEXT NULL" & comma & \
"notes TEXT NULL)"

It works fine, until you try to insert something other than an international character or trademark symbol etc.

Thanks

Andy

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

Post by Janschenkel » Mon Nov 05, 2007 1:21 pm

Hi Andy,

Internally, Revolution works with UTF-16, which can be dependent on the host platform. It is generally advisable to use UTF-8 on the 'end-points', where data goes in or comes out.

Code: Select all

put uniDecode(theString,"UTF8") into theUTF8String
Another option is to rely on the htmlText property, where diacritical characters are converted to numbers.

Code: Select all

set the text of the templateField to theString
put the htmlText of the templateField into theHtmlString
Hope this helped,

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

andyh1234
Posts: 476
Joined: Mon Aug 13, 2007 4:44 pm
Contact:

Post by andyh1234 » Thu Nov 08, 2007 1:31 am

Thanks Jan, that helped a lot!

Andy

Post Reply