|
在SQLite存储的blob类型转换为字符串乱码:
DataTable dt = SQLiteDB.getChatRecord(messageInfo);
richText_InfoRecord.Clear();
if (dt != null && dt.Rows.Count > 0)
{
foreach (DataRow dr in dt.Rows)
{
//聊天时间
richText_InfoRecord.Select(richText_InfoRecord.TextLength, 0);
string s = dr[0].ToString() + " ";
//联系人
string s1= dr[1].ToString();
richTextBox1.Text = s1;
richText_InfoRecord.SelectedRtf = richTextBox1.Rtf;
s += s1 ;
//聊天记录
byte[] bytes = (byte[])dr[3];
richText_InfoRecord.Select(richText_InfoRecord.TextLength, 0);
// richText_InfoRecord.SelectedRtf = Encoding.Unicode.GetString(bytes);
s += Encoding.Unicode.GetString(bytes);
richText_InfoRecord.ScrollToCaret();
richText_InfoRecord.Rtf = s;
}
}
我向将时间、聊天人、聊天信息放在一个字符串里,但这样总是出现格式错误,希望改正。 |
|