Office中国论坛/Access中国论坛

标题: [求助]为什么用SYSTEM.IO读取文本文件中的汉字会成乱码。 [打印本页]

作者: fan0217    时间: 2006-9-15 05:15
标题: [求助]为什么用SYSTEM.IO读取文本文件中的汉字会成乱码。
    在ASP.net 2.0 中使用SYSTEM.IO读取文本文件中的汉字会成乱码(VB.net)。请指教!

Sub ReadAllText(ByVal strTxtFile As String)
        If System.IO.File.Exists(strTxtFile) Then
            Dim ReadText As System.IO.TextReader = System.IO.File.OpenText(strTxtFile)
            Dim strTextLine As String
            Do
                strTextLine = ReadText.ReadLine
                If Not (strTextLine Is Nothing) Then
                    '///////////////////
                    Response.Write(strTextLine)
                    Response.Write("<br>")
                    '///////////////////
                End If
            Loop Until strTextLine Is Nothing
            ReadText.Close()
        End If
    End Sub




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3