private byte[] getUnicodeBytesWithBoom(string strMsg)
{
byte[] buffer;
System.Text.UnicodeEncoding enc = new System.Text.UnicodeEncoding();
buffer = enc.GetBytes(strMsg);
byte[] boom = new byte[2];
boom[0] = 0xff;
boom[1] = 0xfe;
byte[] ret = new byte[buffer.Length + boom.Length];
boom.CopyTo(ret, 0);
buffer.CopyTo(ret, boom.Length);
return ret;
}
private void sendTable(string strTableName)
{
string filecontent = TRDatabase.getTableContent(strTableName);
byte[] buffer = getUnicodeBytesWithBoom(filecontent);
Response.Clear();
Response.ContentType = "Application/UnKnown";
Response.AddHeader("Content-Disposition", "attachment;filename=" + strTableName + ".txt");
Response.OutputStream.Write(buffer, 0, buffer.Length);
Response.End();
}