Encoding.Default
Imports System.Text
Imports System.IO
Public Class Tester
Public Shared Sub Main
Dim myFileStream As FileStream
Dim myStreamReader As StreamReader
Dim strRead As String = ""
Dim StreamEncoding As Encoding
Try
StreamEncoding = Encoding.Default
'StreamEncoding = Encoding.Unicode
'StreamEncoding = Encoding.UTF8
'StreamEncoding = Encoding.UTF7
myFileStream = New FileStream("test.txt", FileMode.Open, FileAccess.Read)
myStreamReader = New StreamReader(myFileStream, StreamEncoding)
Console.WriteLine(myStreamReader.ReadToEnd)
myFileStream.Close()
myStreamReader.Close()
Catch EX As IOException
Console.WriteLine(EX.Message)
End Try
End Sub
End Class
Related examples in the same category