I am trying to learn about asynchronous programming using VS2012 and its Async Await keyword. This is why I wrote this piece of code:
protected override async void OnNavigatedTo(NavigationEventArgs e)
{
string get = await GetResultsAsync("http://saskir.medinet.se");
resultsTextBox.Text = get;
}
private async Task<string> GetResultsAsync(string uri)
{
HttpClient client = new HttpClient();
return await client.GetStringAsync(uri);
}
The problem is that when I try to debug the application, I get an error message:
The character set provided in ContentType is not valid. Cannot read contents as a string using the wrong character set.
I think this is because there is some Swedish character on the site, but I can not find how to change the response encoding. Can anyone direct me plz?
source
share