473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

WEBRESPONSE ENCODING PROBLEM

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()
Sep 17 '07 #1
1 2410
Better to post on the aspnet newsgroup,
<in da clubwrote in message
news:uu****************@TK2MSFTNGP03.phx.gbl...
>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()


Sep 17 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jonax | last post by:
Hi guys, I have the following code that retrieves a webpage. My problem is getting it to use the right encoding. I've tested it against a danish page, but it won't show the danish characters....
0
by: Johann Blake | last post by:
In my need to decode a JPEG 2000 file, I discovered like many that there was no functionality for this in the .NET Framework. Instead of forking out a pile of cash to do this, I came up with the...
2
by: gizmo | last post by:
Hi, I'm using the following code to request the html source from the quoted site. ...... string url = "http://www1.soccerstand.com/"; WebRequest webRequest = WebRequest.Create(url);...
0
by: Tony Archer | last post by:
Here's my problem... When I use this code to hit the site in question I'm redirected to another SSL login page. If processed successfully the page creates a cookie and then redirects you to the...
0
by: Mamatha | last post by:
Hi I have developed one application in VB.NET which extracts the source code of Web pages.I gave a bunch of URLs in a listbox while at the time of response from the web it was...
4
by: Savas Ates | last post by:
I have a vb.net web application. I want to post some variables to another web page and take some values back and process them. This is codes in my target url. I should post "langpair" cariable...
1
by: Mr Flibble | last post by:
OK I logon to a web site and I manage to get an SMSESSION cookie that I then store in a variable called _session (a class scoping variable). I do this by calling a logon URL and setting a cookie...
6
by: nakul.reddy | last post by:
I'm trying to use HTTPWebRequest to POST data to a website using multipart/form-data. It's HTTPS, and it returns a response object with -1 ContentLength. Any help would be appreciated! Below...
0
by: deeps1512 | last post by:
hi All, I have written the following code to get a webresponse. XmlDocument myxmlDoc1 = new XmlDocument(); myxmlDoc1.LoadXml(BkXMLRQ); string s = myxmlDoc1.OuterXml;...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.