I am doing a WebRequest on a Swedish page. In this example The problem is that all the swedish characters are taken away from the stream. I would like to save it all later as UTF8. Why are the swedish characters taken away? Here is my code:
Dim myRequest As HttpWebRequest = Nothing
myRequest = DirectCast(WebRequest.Create(" HttpWebRequest)
myRequest.Method = "GET"
myRequest.ContentType = "application/x- charset=UTF-8"
Dim myHttpWebResponse As HttpWebResponse = DirectCast(myRequest.GetResponse(), HttpWebResponse)
If myRequest.HaveResponse Then
Dim streamResponse As Stream = myHttpWebResponse.GetResponseStream
'Get stream object
Dim streamRead As StreamReader = New StreamReader(streamResponse)
MsgBox(streamRead.ReadToEnd())
' Release the response object resources.
streamRead.Close()
streamResponse.Close()
'Close response
myHttpWebResponse.Close()
End If
Dim myRequest As HttpWebRequest = Nothing
myRequest = DirectCast(WebRequest.Create(" HttpWebRequest)
myRequest.Method = "GET"
myRequest.ContentType = "application/x- charset=UTF-8"
Dim myHttpWebResponse As HttpWebResponse = DirectCast(myRequest.GetResponse(), HttpWebResponse)
If myRequest.HaveResponse Then
Dim streamResponse As Stream = myHttpWebResponse.GetResponseStream
'Get stream object
Dim streamRead As StreamReader = New StreamReader(streamResponse)
MsgBox(streamRead.ReadToEnd())
' Release the response object resources.
streamRead.Close()
streamResponse.Close()
'Close response
myHttpWebResponse.Close()
End If