C# 从ini文件中读取文本到textbox,中文乱码问题

protected void Button_get_Click(object sender, EventArgs e)
{
string FullFileName = @"F:\111.txt";
string MyText = "", ch;
int a = 0;
//以打开,只读的方式创建文件流MyFile
FileStream MyFile = new FileStream(FullFileName, FileMode.Open, FileAccess.Read);
a = MyFile.ReadByte();
while (a != -1)
{
ch = ((char)a).ToString();
MyText = MyText + ch;
a = MyFile.ReadByte();
}
TextBox1.Text = MyText;
MyFile.Close();

}

    每个中文由两个字串符构成。

    读取字串符的时候,先转换为ascii码,如果转换值大于127,那么这个字串符是中文,那么就提取两个字串符。

追问

比较菜,能给代码么?愿给高分。

追答

我只是使用autolisp,在lisp里面,就是这样分析字串符的中文。不够什么程序,思路是相通的。

温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答