用StreamReader的ReadLine()方法从文本文件中读出来的中文是乱码,如下例,怎样解决?
StreamReader a = new StreamReader(@"c:\abc.txt");
Label1.Text = a.ReadLine();
这样, Label1中显示的是乱码,而非中文,但字母就正常.
StreamReader a = new StreamReader(@"c:\abc.txt");
Label1.Text = a.ReadLine();
这样, Label1中显示的是乱码,而非中文,但字母就正常.
你们不妨试试.
如果真不能解决,能有StreamReader的代用品吗?
F: TextFile;
S: String;
begin
AssignFile(F,'c:\abc.txt');
Reset(F);
while not Eof(F) do
begin
Readln(F,S);
Label1.Caption := S;
end;
end;
试试用这种方法呢?