First, my apologies if this question is trivial or if it's been answered 100 times already.
I have a sqlite database with text in unicode utf16. When I use it with programs like SQLiteStudio there's no problem with the database. However, from LiveCode I can't query the database for text in Unicode (it returns empty). And when I query the DB using numeral fields, the Unicode text (is Greek, if you are wondering) are rubbish.
Again, I am afraid this can be a quite trivial question.
I am using LC 7.1.2 on a Mac (OS X 10.11).
Best,
Daniel
SQLite and Unicode
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: SQLite and Unicode
OK, I'll answer myself (and anybody with the same problem): before querying the database (let's say data was introduced in UTF8) you "textencode" the string to search with a SELECT statement, like
and you textdecode the results
That makes the trick
Daniel
Code: Select all
put textEncode(searchText,"UTF8") into searchText
Code: Select all
put textDecode(textFound,"UTF8") into textFound
Daniel
Re: SQLite and Unicode
Thanks Daniel. It works!
-
- VIP Livecode Opensource Backer
- Posts: 7210
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: SQLite and Unicode
Lol. So the reason I can't always answer my own questions is because I forget to thank myself.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: SQLite and Unicode
Don't forget to textEncode any data you INSERT or UPDATE into the database.
Pete
Pete