I have a function which takes some parameters and gets a web page which
includes some specific Turkish characters. Im using UTF-8 encoding , but in
my response text there are ? charecters instead of some Turkish characters.
What can be the problem ?
Public Function IstekYap(ByVal PosURL As String, ByVal Method As String,
ByVal YollanacakVeri As String)
Dim objURI As Uri = New Uri(PosURL)
Dim objWebRequest As WebRequest = WebRequest.Crea te(objURI)
Dim body() As Byte
Dim requestStream As System.IO.Strea m
Dim encoding As New System.Text.UTF 8Encoding
objWebRequest.M ethod = Method
objWebRequest.C ontentType = "applicatio n/x-www-form-urlencoded"
body = encoding.GetByt es(YollanacakVe ri)
objWebRequest.C ontentLength = body.Length
requestStream = objWebRequest.G etRequestStream
requestStream.W rite(body, 0, body.Length)
Dim objWebResponse As WebResponse = objWebRequest.G etResponse()
Dim objStream As Stream = objWebResponse. GetResponseStre am()
Dim objStreamReader As StreamReader = New StreamReader(ob jStream,
System.Text.Enc oding.UTF8)
Dim strHTML As String = objStreamReader .ReadToEnd
Return (strHTML)
End Function
///////////////////////////////////////////////////////////////
Dim str As String
str = (((IstekYap(http://xx.com, "POST", "?str=1"))) )
Dim writer As New StreamWriter("c :\deneme.html", False,
System.Text.Enc oding.UTF8)
writer.Write(st r)
writer.Flush()
writer.Close()