I'm trying to scrape a webpage using this code, cut out a piece of text I want from the HTML code, and finally show it in a textbox. The problem I'm having is that special/foreign characters are shown as diamond question marks. The webpage says it's charset=ISO-8859-1.
I tried setting the encoding with the line that is commented out below, but it made no difference. I tried the other encodings as well like UTF8.
What shall I do to read this webpage in a better way?
Here's the code I have so far:
Code:Dim myWebClient As New Net.WebClient() 'myWebClient.Encoding = System.Text.Encoding.GetEncoding("ISO-8859-1") Dim myStream As IO.Stream = myWebClient.OpenRead(url) Dim sr As New IO.StreamReader(myStream) Dim myString As String = sr.ReadToEnd myStream.Close()




Reply With Quote