I'm reading a text from c# saving it through a insert parameter in a
varchar column of a table. Both the file and the sqlite db encoding is
utf-8 but I see different characters (it seems due to a bad encoding) while
reading data from the sqlite3 command line or from other clients...
sqlite-users mailing list
[hidden email] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Sounds like you're passing a non utf-8 encoded string from C# directly
The easiest way I know of to check the actual data in the database is to
dump it as hex (i.e., select hex(column_name)) and check if the contents
are what you expect or not.
Gut feeling is that the strings in the database will be incorrect which
would mean that the problem is on the C# binding side. The problem is
most likely located where the C# strings are converted to C strings. I'm
not a C# user, but from the documentation it looks like you (or the
binding you're using) should be calling Encoding.UTF8.GetBytes(myString)
somewhere. Perhaps that's something you could check for in the code?
On 19-01-14 16:57, cinema cinema wrote:
> I'm reading a text from c# saving it through a insert parameter in a
> varchar column of a table. Both the file and the sqlite db encoding is
> utf-8 but I see different characters (it seems due to a bad encoding) while
> reading data from the sqlite3 command line or from other clients...
> Any suggestion?
> sqlite-users mailing list
> [hidden email] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
thank you very much for your answer, you are saying a lot of right things.
I believe that your most important suggestion is to use the hex function.
I didn't know this sqlite command andI I will try it soon.
In the meantime I solved my problem Jand I wrote a post also here:
http://stackoverflow.com/questions/21219600/sqlite-encoding-from-net If you are also a SO user and you want to reply there, I'll be happy to mark this as answered.
Note that initially I started addind those encoding lines in c# ... And finally I realised that
the problem was not there :-)
I suspect that for the sqlite mailinglist it is offtopic adding a comment about sqliteadmin showing text in ansi and not in unicode...
In any case also the sqlite3 is showing text against windows codepage cmd... :-)
Had I used the select hex, maybe I would have easily understood that my vanilla c# string insert was correctly writing
a utf-8 sequence of c2 a0 to represent the non breaking space