当前位置:首页 > 数据库 > SQlite

c# – 不将土耳其语字符8 Window应用程序插入Sqlite

我一直在使用Windows 8 App上的Sqlite数据库.(Sqlite for Windows Runtime)
我插入数据库时??的土耳其字符问题.
我该如何解决这个问题.你能帮助我吗?
非常感谢你.
简单的来.

using (var db = new SQLite.SQLiteConnection(App.DbPath))
    db.Execute("Insert Into Stock (Name) Values('??????')");

我尝试这个但结果 – > ÞþÝýÐð

string a = "??????";    
string b = string.Empty;    
byte[] utf8Bytes = Encoding.UTF8.GetBytes(a);    
b= Encoding.UTF8.GetString(utf8Bytes, 0, utf8Bytes.Length);    

using (var db = new SQLite.SQLiteConnection(App.DbPath))
    db.Execute("Insert Into Stock (Name) Values('"+ b +"')");

解决方法:

最有可能的问题是您的列无法正确处理UTF-16(unicode)(可能是客户端API).最安全的做法是在客户端转换为/从utf-8转换,然后读/写数据库.

System.Encoding.UTF8具有所有魔力.


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!