M
Mangesh
hi,
I am using HTTPWebrequest object to download google results.
in the response stream I am not getting some foreign characters
eg. If I search "signo de pregunta", all the spanish characters are
missing in response stream.
The same search in the internet explorer shows all the characters.
I am sending all the required headers with the HTTPWebrequest.
Following code is used to get gogle results
-------------------------------------------------------------------
' Setup our Web request
objrequest = CType(WebRequest.Create(URL),
HttpWebRequest)
objrequest.Accept = "*/*"
objrequest.Headers.Add("Accept-Encoding", "gzip,
deflate")
objrequest.Headers.Add("Accept-Language", "en-us")
objrequest.ContentType = "text/html; charset=UTF-8"
objrequest.Timeout = TimeoutSeconds * 1000
' Retrieve data from request
objResponse = CType(objrequest.GetResponse,
HttpWebResponse)
'objStreamReceive = objResponse.GetResponseStream
objEncoding =
System.Text.Encoding.GetEncoding("utf-8")
objStreamRead = New
System.IO.StreamReader(objResponse.GetResponseStream,
Text.Encoding.UTF7)
' Set function return value
PageHTML = objStreamRead.ReadToEnd()
I am using HTTPWebrequest object to download google results.
in the response stream I am not getting some foreign characters
eg. If I search "signo de pregunta", all the spanish characters are
missing in response stream.
The same search in the internet explorer shows all the characters.
I am sending all the required headers with the HTTPWebrequest.
Following code is used to get gogle results
-------------------------------------------------------------------
' Setup our Web request
objrequest = CType(WebRequest.Create(URL),
HttpWebRequest)
objrequest.Accept = "*/*"
objrequest.Headers.Add("Accept-Encoding", "gzip,
deflate")
objrequest.Headers.Add("Accept-Language", "en-us")
objrequest.ContentType = "text/html; charset=UTF-8"
objrequest.Timeout = TimeoutSeconds * 1000
' Retrieve data from request
objResponse = CType(objrequest.GetResponse,
HttpWebResponse)
'objStreamReceive = objResponse.GetResponseStream
objEncoding =
System.Text.Encoding.GetEncoding("utf-8")
objStreamRead = New
System.IO.StreamReader(objResponse.GetResponseStream,
Text.Encoding.UTF7)
' Set function return value
PageHTML = objStreamRead.ReadToEnd()