Hallo,
I am using a database which is created/updated by a third party vendor. He seems to use a different encoding for string. Unfortunately SQLite.NET only supports UTF8 and UFT16.
After digging into the source code for five minutes I found that the UT8 case uses the Encoding class, which could be changed. Although the code is not public so I am using reflection ;-)
SQLiteConnection connection = new SQLiteConnection();
SQLiteConnectionStringBuilder builder = new SQLiteConnectionStringBuilder();
builder.DataSource = "database.sq3";;
connection.ConnectionString = builder.ConnectionString;
connection.Open();
FieldInfo fieldInfo = connection.GetType().GetField( "_sql", BindingFlags.Instance | BindingFlags.NonPublic );
SQLiteConvert convert = (SQLiteConvert)fieldInfo.GetValue( connection );
fieldInfo = convert.GetType().BaseType.BaseType.GetField( "_utf8", BindingFlags.Static | BindingFlags.NonPublic| BindingFlags.FlattenHierarchy );
fieldInfo.SetValue( convert, Encoding.Default );
After that the strings come out fine.
I suggest to support other encodings in the connection string. Simply convert the encoding name to the proper Encoding class with Encoding.GetEncoding( name ).
btw: It is allowd to insert pure html into the postings. Great way to inject some bad iframes or java script code... :-(
Other forums use pseudo tags (i.e.
) and convert allowed tags to real tags.