G
Guest
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.Create(objURI)
Dim body() As Byte
Dim requestStream As System.IO.Stream
Dim encoding As New System.Text.UTF8Encoding
objWebRequest.Method = Method
objWebRequest.ContentType = "application/x-www-form-urlencoded"
body = encoding.GetBytes(YollanacakVeri)
objWebRequest.ContentLength = body.Length
requestStream = objWebRequest.GetRequestStream
requestStream.Write(body, 0, body.Length)
Dim objWebResponse As WebResponse = objWebRequest.GetResponse()
Dim objStream As Stream = objWebResponse.GetResponseStream()
Dim objStreamReader As StreamReader = New StreamReader(objStream,
System.Text.Encoding.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.Encoding.UTF8)
writer.Write(str)
writer.Flush()
writer.Close()
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.Create(objURI)
Dim body() As Byte
Dim requestStream As System.IO.Stream
Dim encoding As New System.Text.UTF8Encoding
objWebRequest.Method = Method
objWebRequest.ContentType = "application/x-www-form-urlencoded"
body = encoding.GetBytes(YollanacakVeri)
objWebRequest.ContentLength = body.Length
requestStream = objWebRequest.GetRequestStream
requestStream.Write(body, 0, body.Length)
Dim objWebResponse As WebResponse = objWebRequest.GetResponse()
Dim objStream As Stream = objWebResponse.GetResponseStream()
Dim objStreamReader As StreamReader = New StreamReader(objStream,
System.Text.Encoding.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.Encoding.UTF8)
writer.Write(str)
writer.Flush()
writer.Close()