您的位置:首页 > 其它

关于Tab分割写入TXT改名为XLS后乱码的问题

2009-01-15 15:11 225 查看
使用Encoding.Unicode字符就不会乱码了,如下:

#region 写入TXT文本
private int WriteTXT(string path, string str)
{
int nReturn = 1;
System.IO.StreamWriter SW = new System.IO.StreamWriter(path, true,Encoding.Unicode);
try
{
SW.AutoFlush = true;
SW.WriteLine(str);
SW.Flush();
}
catch (Exception e)
{
BaseClass.WriteFile.WriteErrLog("WriteTXT " + str + " into " + Path.GetFileName(path) + ": " + e.Message);
nReturn = 0;
}
finally
{
SW.Close();
}
return nReturn;
}
#endregion
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: