|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
StreamReader does not read all characters...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. Show quoteHide quote "rVo" <d***@vlaamsparlement.be> wrote in message news:Ohgt5HyIGHA.3408@TK2MSFTNGP12.phx.gbl... > > 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 > > 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 Show quoteHide quote "Marius Groenendijk" <M (underscore) Groenendijk At (VeryWarm) Mail> schreef in bericht news:%23bxYXjyIGHA.516@TK2MSFTNGP15.phx.gbl... > 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. > > "rVo" <d***@vlaamsparlement.be> wrote in message > news:Ohgt5HyIGHA.3408@TK2MSFTNGP12.phx.gbl... > > > > 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 > > > > > > |
|||||||||||||||||||||||