Link to home
Start Free TrialLog in
Avatar of wwarby
wwarby

asked on

European characters garbled when inserted using SQLite for .NET

I have a problem where foreign characters get messed up when I write them to the database from .NET. Sample code made as simple as possible:

Dim cnn As New System.Data.SQLite.SQLiteConnection("test.db;UseUTF16Encoding=true")
cnn.Open()
Dim cmd As New System.Data.SQLite.SQLiteCommand("INSERT INTO test (test) VALUES ('Àlex')", cnn)
cmd.ExecuteNonQuery()

Result:

When I look at the table in SQLite Administrator, the field value shows as "Àlex". When I run the exact same query directly in SQLite Administratr, the field value shows correctly. What am I doing wrong?
ASKER CERTIFIED SOLUTION
Avatar of wdosanjos
wdosanjos
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of wwarby
wwarby

ASKER

wdosanjos: Idiotically, I hadn't even thought to try reading the data back in .NET since I could see it was wrong in SQLite Administrator, but you're absolutely right - it comes out exactly as it went in in .NET - it just looks wrong in the SQLite Administrator which makes the problem more of an annoyance than a crippling obstacle. There seems to be no way to change the display in SQLite Administrator but I can live with it. Thanks!