Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

OEM to ANSI

I got an OEM file and I use a StreamReader to read it but I got a problem that the file may got some characters that StreamReader can not read so it reads only some data of it.

eg.

Dim StreamToDisplay As New StreamReader("C:OEMFILE.DAT", _ Encoding.GetEncoding(CultureInfo.CurrentCulture.TextInfo.OEMCodePage))
Dim aLine As String
Do
aLine = StreamToDisplay.ReadLine
TextBox1.Text += aLine + Chr(13) + Chr(10)
Loop Until aLine = Nothing
StreamToDisplay.Close()

When it ends then I see at the TextBox that the file is has not be read right. I tried the FileOpen method but the same problem occured.
The encoding is correct cause when I open the OEMFILE.DAT through the Notepad and simple save it with the same name then the StreamReader can read it correct. But the point is that it must be done without the help of the Notepad.

Any help ?




Sign In or Register to comment.