Fwd: SQLite and Unicode
Fwd: SQLite and Unicode
- Subject: Fwd: SQLite and Unicode
- From: Тимофей Даньшин <email@hidden>
- Date: Tue, 7 Apr 2009 20:39:53 +0400
On Apr 7, 2009, at 8:14 PM, Keary Suska wrote:
Are you properly encoding your C strings with -cStringUsingEncoding:?
Yes, I think so.
At present, I am using the -UTF8String method, but I also tried the -
cStringUsingEncoding: to no avail.
Here is the line that binds the string to the prepared statement:
sqlite3_bind_text(sentence_insert_statement, 1, [string UTF8String],
-1, SQLITE_TRANSIENT);
and I translate it back into NSString by [string
stringWithUTF8String], although I also tried the -stringWithCString:
encoding: method. The characters _are_ mangled.
And the funny thing is that i am able to add non-latin strings to it
by reading sql files from SQLite in Terminal...
Best regards, Timofey.
On Apr 6, 2009, at 2:31 PM, Тимофей Даньшин wrote:
When I insert non-latin strings into my SQLite3 database, they turn
into some weird sets of characters (as I select those strings later
in Terminal), and the fields, which contain those strings, become
unusable by my application.
I googled for it for quite a bit, but everywhere it says that
SQLite 3 supports utf8, so there is no advice on what should be
done in such situations.
What can I do about it?
Are you properly encoding your C strings with -
cStringUsingEncoding:? If so, when you query the column (and
properly translate the C string to NSString using -
stringWithCString:encoding:), are the characters still mangled?
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden