一早起来就接到消息说论坛被人利用漏洞删了...
这年头还真是闲人无数...
于是睡眠不足的脑袋开始搅动了...
一不小心就把原数据库盖掉了,手里只剩下latin1的乱码一滩...
没办法了...只能着手转码咯...还真是无聊的工作...
google上那个翻来翻去,终于找到latin1的codepage是1252...
using (OpenFileDialog ofd = new OpenFileDialog())
{
ofd.Filter = "MySQL|*.sql";
if (ofd.ShowDialog() == DialogResult.OK)
{
string oldName = ofd.FileName;
string newName = Path.GetFileNameWithoutExtension(oldName) + "_fix" + Path.GetExtension(oldName);
byte[] bytes = File.ReadAllBytes(ofd.FileName);
byte[] bytesfix = Encoding.Convert(Encoding.UTF8, Encoding.GetEncoding(1252), bytes);
File.WriteAllBytes(newName, bytesfix);
}
}