CharacterSet problem

C

CreateObject

I am a newbie user. I am trying to get source code of a webpage using
WebRequest and WebResponse. I've managed to get source code but this time I
got stuck on character set. I can't display non-English characters like ÞÇÜÝ
and so on.
Here is my code;

WebRequest objReq = HttpWebRequest.Create("http://localhost");
objReq.ContentType = "text/html; charset=iso-8859-9";

WebResponse objRes = objReq.GetResponse();
StreamReader sr = new StreamReader (objRes.GetResponseStream());

string code = sr.ReadToEnd();
-------------------------------------
I always feel hard to deal with character releated things both while
developing applications and websites. Is there any way to get the idea
behind???

Thanks
 
C

CreateObject

I solved the problem
I used the default encoding for stream reader and that's the magic thing :)
new StreamReader (objRes.GetResponseStream(), Encoding.Default);
Thanx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top