webclass: ENCODING

S

SiD`

hi all,

I use the WebClient class to cominicate with HTTP server.

I use the following function for the GET method:

Dim wDownload As System.Net.WebClient = New System.Net.WebClient
Dim bHTML As Byte() = wDownload.DownloadData(sCompleteURL)
Dim sWebPage As String = Encoding.UTF7.GetChars(bHTML)
Return sWebPage

if I use Encoding.ASCII, only 'standard' letters are got correctly, but,
as I am italian, I need also other 'strange' letters, like à or è...
Encoding.ASCII will convert them with a ? (question mark)

using UTF8, it does not still work, i think it just erase those
characters....

using UTF7, it works better, but still not perfectly: è, ò, à, etc...
are ok, but ' or CHR(96) (`) are converted with a ?

using Unicode (no matter what kind), the text is lost, the function
returns no text.


How can I get the right text from a html page?


Thanks!
SiD`
 
H

Herfried K. Wagner [MVP]

* SiD` said:
I use the WebClient class to cominicate with HTTP server.

I use the following function for the GET method:

Dim wDownload As System.Net.WebClient = New System.Net.WebClient
Dim bHTML As Byte() = wDownload.DownloadData(sCompleteURL)
Dim sWebPage As String = Encoding.UTF7.GetChars(bHTML)
Return sWebPage

if I use Encoding.ASCII, only 'standard' letters are got correctly,
but, as I am italian, I need also other 'strange' letters, like à or
è...

Encoding.ASCII will convert them with a ? (question mark)

Try 'Encoding.Default', which will pick up your ANSI code page.
 

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