954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Character in textbox after getting sourcecode are not shown properly

Hello Guyz
This is my first post here.
I am having problem in vb.net
I am trying to get a webpage source using this code.

Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(Textbox1.Text)
            Dim response As System.Net.HttpWebResponse = request.GetResponse()

            Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())

            Dim sourcecode As String = sr.ReadToEnd()

           Textbox2.Text = sourcecode


Now whenever there is a unicode character in sourcecode it is not showed properly.

But when i manually write that unicode character then it works fine.
Any Idea?
Hoping for quick response.

vb2learn
Newbie Poster
14 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
 

plz someone help ????

vb2learn
Newbie Poster
14 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
 

Can you provide a link to such a site? Should help with narrowing down a possible solution.

codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
 

@ codeorder

One example of such a website is

http://www.downarchive.com/software/internet/383218-advanced-host-monitor-enterprise-884.html

After Features it doesn't show right characters. But on writing it appears ok.

Thanks once again. Plz help

vb2learn
Newbie Poster
14 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
 

Replace line 4 from your posted code with this.

Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream, System.Text.Encoding.Default)
codeorder
Posting Virtuoso
1,913 posts since Aug 2010
Reputation Points: 255
Solved Threads: 384
 

@codeorder
Thanks Mate.
My problem has been resolved.

Thread Marked as Resolved

vb2learn
Newbie Poster
14 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: