469,267 Members | 979 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,267 developers. It's quick & easy.

Reading web page

Hi, I have a problem while reading the text of a web page.
I use the following code:

System.Net.WebClient webc= new System.Net.WebClient();
webc.Headers.Clear();

//Here I add some headers...
byte[] bytes=webc.DownloadData(url);

System.Text.UTF8Encoding decoder= new System.Text.UTF8Encoding();
string dataread=decoder.GetString(bytes);
return dataread;
The code works well with english pages, but I have some problems with
other european languages: characters like ,,, are skipped, I can
not find them in the read data.
I guess it's caused by the encoding, may be UTF8Encoding isn't
correct...
Am I right?
Thanks,
Lorenzo
Nov 19 '05 #1
1 1040
you should look at the Content-Type header, to see if a character set is
specified, and also the <meta http-equiv="Content-Type"> tag to determine
the character set (override the header if specified).

-- bruce (sqlwork.com)
"lorenzo" <lo**************@gmail.com> wrote in message
news:e7**************************@posting.google.c om...
| Hi, I have a problem while reading the text of a web page.
| I use the following code:
|
| System.Net.WebClient webc= new System.Net.WebClient();
| webc.Headers.Clear();
|
| //Here I add some headers...
|
|
| byte[] bytes=webc.DownloadData(url);
|
|
|
| System.Text.UTF8Encoding decoder= new System.Text.UTF8Encoding();
|
|
| string dataread=decoder.GetString(bytes);
|
|
| return dataread;
|
|
| The code works well with english pages, but I have some problems with
| other european languages: characters like ,,, are skipped, I can
| not find them in the read data.
| I guess it's caused by the encoding, may be UTF8Encoding isn't
| correct...
| Am I right?
| Thanks,
| Lorenzo
Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by JoelWhitehouse | last post: by
3 posts views Thread by Nelson R. | last post: by
2 posts views Thread by Thief_ | last post: by
7 posts views Thread by Nuno Magalhaes | last post: by
9 posts views Thread by Mike Reed | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.