Gridview显示不同的字符而不是utf-8中的字符

时间:2019-05-03 15:00:53

标签: c# asp.net json gridview utf-8

我将JSON数据解析为具有utf-8字符的gridview,但gridview中的数据未显示utf-8。我在gridview中对列标题进行了硬编码,它显示utf-8字符。我加了:

 <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" />

但是它不能正确显示字符。

这是我的解析器:

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;
    }
}

0 个答案:

没有答案