vb.net 按行读取文件时,英文没错,但中文就出现乱码,请教为何?
下面是我的代码,请教各位大虾。PublicalAsNewSystem.Collections.ArrayList()PublicnAsIntegerPrivateSubB...
下面是我的代码,请教各位大虾。 Public al As New System.Collections.ArrayList()
Public n As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sr As New System.IO.StreamReader(Application.StartupPath & "\1.txt")
Do While sr.Peek > -1
Dim line As String
line = sr.ReadLine
n = n + 1
al.Add(line)
Loop
sr.Close()
End Sub 展开
Public n As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sr As New System.IO.StreamReader(Application.StartupPath & "\1.txt")
Do While sr.Peek > -1
Dim line As String
line = sr.ReadLine
n = n + 1
al.Add(line)
Loop
sr.Close()
End Sub 展开
2013-07-10
展开全部
Dim sr As New System.IO.StreamReader(Application.StartupPath & "\1.txt",System.Text.Encoding.GetEncoding("GB2312")) 中文默认是 GB2312格式的.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询