error formatting byte to string ?

kimrune

Newcomer
Joined
Jun 24, 2003
Messages
7
Hey...
Hope someone knows the answer for this :)

I'm using this code to grab content from an URL.
The problem is, when displaying the String s all the chars æ, ø, and å is not displayed right.. They come out as ? or x or some other cryptic characters...
How can I display the characters correctly?

This is the code:

Dim wc As New WebClient
Dim strArray As Array
Dim s As String
Dim b() As Byte

b = wc.DownloadData(url)
s = Encoding.ASCII.GetString(b)


Would appreciate any help I can get :)
 
What character set is the webpage encoded in?
you may want to try replacing the line

s = Encoding.ASCII.GetString(b)
with one of the following

s = Encoding.Unicode.GetString
or
s = Encoding.UTF8.GetString
 
Back
Top