1

I parsed JSON data to a gridview which has utf-8 characters, but data in gridview doesn't show utf-8. I hardcoded titles of columns in gridview and it shows utf-8 characters. I added:

 <system.web>
 <globalization fileEncoding="utf-8" requestEncoding="utf-8" 
 responseEncoding="utf-8" culture="en-US"/>` and `<meta http-equiv="content- 
 type" content="text/html; charset=utf-8" />

But it isn't showing characters correctly.

This is my parser:

public static List<Currency> ParseCurrency()
{
    using (WebClient webClient = new System.Net.WebClient())
    {
        WebClient client = new WebClient();
        var json = client.DownloadString("http://api.hnb.hr/tecajn/v2");
        List<Currency> currencies =
        JsonConvert.DeserializeObject<List<Currency>>(json);
        Console.WriteLine(currencies.Count);
        return currencies;
    }
}
dbc
  • 104,963
  • 20
  • 228
  • 340
  • 1
    1) Try setting the encoding intelligently as shown in [WebClient.DownloadString() returns string with peculiar characters](https://stackoverflow.com/a/30049848/3744182) or manually as shown in [WebClient.DownloadString results in mangled characters due to encoding issues, but the browser is OK](https://stackoverflow.com/a/7137997). 2) You have two different `WebClient` variables, `client` and `webClient`. You only need one. – dbc May 03 '19 at 19:39
  • 1
    yes that is the answer, thank you very much :D – Nadan Marenković May 03 '19 at 21:05

0 Answers0