JSON反序列化 - 单引号显示为“。”

时间:2018-01-21 11:26:47

标签: c# winforms json.net

我正在使用Newtonsoft.Json包,在我反序列化一些json对象后,我将结果字符串放在listBox中。我注意到如果文本包含单引号等字符,则在我的列表框中添加的文本包含值â€。我读到这是由于原始字符串的unicode或UTF8编码,但我不知道如何翻译它,以便我的listBox将显示正确的方式。

我预计有必要使用UTF8或Unicode解码吗?

    jsonData = JsonConvert.DeserializeObject(sJsonCode);
    foreach (var message in jsonData["messages"])                
    {
        string body = message.body.ToString();  // if message.body contains single quotes, they will be displayed as ’
        listBox1.Items.Add(body);
    }

0 个答案:

没有答案