SQLite, Unicode & LC

Kay C Lan lan.kc.macmail at gmail.com
Wed Apr 9 02:46:23 CEST 2014


Glad I could get you over the first hurdle.

Seems though we might be hitting the 2nd hurdle at the same time.

I'm reading a file into LC and it contains this word:

Cabañesas  --the 5th char being numToChar(150) on Mac

it ends up in a variable exactly the same. I then feed it into a SQLite
database and if I view it with Valentina Studio or Navicat it appears just
the same. But if I then use LC to query the db the variable contains:

Cabañesas  --5th & 6th char are numToChar(195) & (177) on Mac

The orginal file is UTF-8, SQLite is UTF-8

I'm not so sure that this is a unicode problem as the numbers are so low,
but above 125, so maybe some other text encoding problem which I'm trying
to nut out right now.

Any insights would be much appreciated.

On Wed, Apr 9, 2014 at 7:07 AM, Peter Haworth <pete at lcsql.com> wrote:

> Thanks for that Kay, I went with that approach and it took perhaps an hour
> to write the import script.
> I am however, whether I like it or not, having to get into the weird world
> of Unicode (I think).  Some of the artist names and CD names in my iTunes
> library have accented characters which end up in the tab delimited file as
> <not what the original character was>. The corrupted characters then end up
> in my database.
> I don't have any control over how iTunes exports the data so is it possible
> for me to ensure that what ends up in my sqlite database is correct?  The
> default text encoding for sqlite db's is UTF-8 but it can be changed to
> UTF-16, UTF-16le, or UTF-16be.
> Assuming that can be done, how do I make sure the artists names and album
> names are correctly displayed in my fields/option menus/datagrids?  Let's
> assume for now that I will not be using LC7 for this

More information about the use-livecode mailing list