Convert UTF-8 string to standard C #

1

I'm downloading a string via WebClient() and I get a string with badly formed accents.

Example:

  

{"fíddiesticks":{"id":4078584,"name":"FíddIesticks","profileIconId":946,"summonerLevel":30,"revisionDate":1475092874000}}

I know that the string I get is in UTF-8 , but I can not convert to the default format of C# that I do not even know what it is.

Code:

private void buttonSummonerBrowse_Click(object sender, EventArgs e)
{
    WebClient webClientSummonerInfo0 = new WebClient();
    webClientSummonerInfo0.DownloadStringCompleted += new DownloadStringCompletedEventHandler(SummonerInfo0_DownloadStringCompleted);
    webClientSummonerInfo0.DownloadStringAsync(new Uri("https://br.api.pvp.net/api/lol/" + comboBoxSummonerRegion.SelectedItem + "/v1.4/summoner/by-name/" + textBoxSummonerName.Text + "?api_key=" + __apiKey));

}

private void SummonerInfo0_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
    MessageBox.Show(e.Result);
}
    
asked by anonymous 28.09.2016 / 22:59

1 answer

1

Set it like this: ( by comment )

WebClient webClientSummonerInfo0 = new WebClient();
webClientSummonerInfo0.Encoding = Encoding.UTF8;

WebClient. Encoding Property

    
28.09.2016 / 23:05