sqlite读取中文乱码(C#)

C#读取一些C++创建的sqlite数据库时乱码,  C++保存DB是用GB2312编码的, C#调用的官方的system.data.sqlite是用的UTF-8编码的, 在读取时会乱码, 用一个GB2312编码的system.data.sqlite就行了.

可以下载sqlite源码修改重编译dll

修改SQliteConvert.cs line52  
  //private static Encoding _utf8 = new UTF8Encoding();
 private static Encoding _utf8 = System.Text.Encoding.GetEncoding("GB2312");

ADO.NET 2.0 Provider for SQLite 1.0.66.0

1.066.0中少个mergebin.exe, 在老版本的1.0.61.0中有. VS2008下载

已经编译好的读取GB2312数据库的DLL(下载), 解压后选择合适的dll, 改名为System.Data.SQLite.dll再使用.

参考:

1.http://blog.sina.com.cn/s/blog_63edfc900100snvw.html

2.vs2008 C# 使用 System.Data.SQLite.dll 字符编码问题
http://topic.csdn.net/u/20090601/11/9edb203e-ae0e-41d8-b21f-cd6147f31408.html
3.vs2008如何编译完整的System.Data.SQLite.dll
http://topic.csdn.net/u/20090603/09/2236072b-da66-459b-b175-fc4676fe984f.html

原文地址:https://www.cnblogs.com/barrysgy/p/4462775.html