StreamReader does not read all characters...

  • Thread starter Thread starter rVo
  • Start date Start date
R

rVo

In a VB.Net application I create a new streamreader and use it's ReadToEnd
function to read the contents of a htmlfile.
Inside the file there are some signs like öéèêë..., these signs are not
present in the stream that has been read by the ReadToEnd function though.

This problem occured in a program that has been running succesfully for
about a yeatr already.

Could this have been caused by recent patches or an upgrade of the dot net
framework (which is now on level 1.1.4322, with dutch language pack and
Hotfix KB886903 installed).

Is there a workaround for this problem by using another method for reading?

Any help is more than welcome as I'm pretty desperate on this one.

Kind Regards,

rVo
 
Hallo,

I'd use the right encoding (ANSI, Unicode ...) on the file.
E.g. for ANSI:

strm = new System.IO.StreamReader(filename,
System.Text.Encoding.Default)

HTH/Bye,
Marius.
 
Thanks Marius, it works now.

To make sure this thread is usefull for other people: use following code to
read an HTML file produced by MS Word in VB.NET
Dim strContents As String

Dim objReader As StreamReader

objReader = New StreamReader(TheFullPathGoesHere,
System.Text.Encoding.GetEncoding("windows-1252"))

strContents = objReader.ReadToEnd()

objReader.Close()

Kind Regards (Bedankt),

rVo
 
Back
Top