We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,267 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

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.

2
Contributors
5
Replies
1 Week
Discussion Span
2 Years Ago
Last Updated
6
Views
Question
Answered
vb2learn
Newbie Poster
14 posts since Mar 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

plz someone help ????

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

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

codeorder
Postaholic
2,124 posts since Aug 2010
Reputation Points: 256
Solved Threads: 387
Skill Endorsements: 8

@ 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
Skill Endorsements: 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
Postaholic
2,124 posts since Aug 2010
Reputation Points: 256
Solved Threads: 387
Skill Endorsements: 8

@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
Skill Endorsements: 0
Question Answered as of 2 Years Ago by codeorder

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0715 seconds using 2.67MB