473,396 Members | 1,982 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,396 software developers and data experts.

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 1200
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Luca | last post by:
Hello Everybody, I'm a 26 years old Italian "Florentine" Computer technician :) I'm writing you about an idea that I've got of a function that could be introduced in new web browsers (or even...
4
by: JoelWhitehouse | last post by:
Hi! I want to write a script that will read a .php file on a remote server and print to the current page a portion of the text contained in the remote file. I am just wondering what the best...
3
by: Darrel | last post by:
I've been working on a fairly simple CMS for a fairly small site. Each page is a DB query to grab the content for the page. I also have some ancillary content that isn't specifically associated...
5
by: darrel | last post by:
I have bits of content on a site that's running of a basic CMS system I've built. The main content on each page is pulled in from the DB, so there's at least one call to the DB on each page...
3
by: Nelson R. | last post by:
Hi, im using a form to get some input from the user. This form is in a HTML file. When I post the form directly to my email, i receive all fields correctly. Example test.html: <FORM...
2
by: Thief_ | last post by:
I'm using the following code to read in a web page as HTML: ' Download the web page using the chosen update method. Dim sr As New...
7
by: Nuno Magalhaes | last post by:
I've got a problem which relates to reading HTTP data. I've got the socket connected to a web site and then I send "GET / HTTP/1.1\n\n" and the page is received after a while but not all of the...
9
by: Mike Reed | last post by:
I must be having a "senile" day! I cannot recall, nor get to work, code to read a cookie's expiration date/time in an ASP page/VBScript. What am I missing? *** Sent via Developersdex...
9
by: Milsnips | last post by:
Hi all. i'm tryng to implement the Rewrite.NET url rewritining functionality into a test project i've created, however i am hitting a problem at this line (direct from the web example): ...
2
by: Derik | last post by:
I've got a XML file I read using a file_get_contents and turn into a simpleXML node every time index.php loads. I suspect this is causing a noticeable lag in my page-execution time. (Or the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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,...

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.