I download a page with encoding: “usa-ascii” but I get wrong character. why??
WebClient wb = new WebClient();
Encoding enc = Encoding.GetEncoding("US-ASCII");
wb.Encoding = enc;
byte[] by = wb.DownloadData(link);
string htmlDoc = enc.GetString(by);
but I get: Pr?z instead of: Präz.
Html of my link: (charest=us-ascii)
<html debug="true">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"/>
</head>
...................
What is wrong???
p.s. I tryed encoding utf-8 and it didn’t work too.
US-ASCII does not have that character, so the page contains an invalid character (for the defined charset). Your code isn’t wrong, the problem is that US-ASCII won’t suffice for characters like
ä.US-ASCII data table: link