问题
I work with Sqlite database in C# and I have this question: Does Sqlite database support Persian/Arabic encoding? Because I have written some Arabic/Persian data in it and when I want to read data from database it is read in unsuitable form!!!
my code :
int len = ds.Tables["tbl"].Rows.Count;
int index = rnd.Next(0, len - 1);
//notifyIcon1.ShowBalloonTip(15, "پیام عشق ", ds.Tables["tbl"].Rows[index][0].ToString(), ToolTipIcon.Info);
string str = ds.Tables["tbl"].Rows[index][0].ToString();
MessageBox.Show(str);
thanks .
next of my code :
DataSet ds;
ds = SQLite_DB.Select_DB(SQLite_DB.Con_string("data.s3db"), "select * from info");
回答1:
So long as you're using Version 3 or higher, you'll be able to use UTF-8 / UTF-16, which is your best bet for Arabic.
回答2:
In short: No.
SQLite support only a very, very limited number of encodings: UTF-8 and UTF-16 (multiple varieties).
Fortunately, UTF-8 is perfectly suitable for expressing Arabic or Persian, or any other language (including Klingon, should the fancy grab you).
It is posible, of course, that some other part of your toolchain is bungling the encoding, check the documentation for the C#.net SQLite wrapper, and your Forms code.
来源:https://stackoverflow.com/questions/6021059/does-sqlite-database-support-persian-arabic-encoding