string pth = Server.MapPath( "file/ ") + Session[ "txt "].ToString();
FileInfo fi = new FileInfo(pth);
using (StreamReader sr = fi.OpenText())
{
string s = " ";
if ((s = sr.ReadToEnd()) == " ")
{
txt.Text = " ";
}
else
{
txt.Text += s;
}
}
------解决方案--------------------------------------------------------
这样读出来的文本编码是GBK编码的.
你确认你的 web.config 中.对编码是否设置对应相同...
------解决方案--------------------------------------------------------
同意,设置编码
------解决方案--------------------------------------------------------
txt文件内容必须为utf-8格式。
记事本打开另存为“utf-8”