Web请求C#获取的带有JSON流的字符串编码

Wil*_*ied 0 c# string encoding json

我在C#中的字符串有点问题.实际上,我通过URL获取JSON流.

WebClient webC   = new WebClient();
string jsonStr = webC.DownloadString("http://www.express-board.fr/api/jobs");
Run Code Online (Sandbox Code Playgroud)

但是当我在控制台中编写字符串时,我遇到了编码问题.

[...]"contract":"Freelance/Indépendant"[...]
Run Code Online (Sandbox Code Playgroud)

我尝试使用Encoding类在stackoverflow上看到很多技巧.但不可能,解决问题.当然,如果我直接在我的网络浏览器中使用链接并在Notepadd ++中打开它没问题.

有时,通过编码的一些组合(我认为是ACSII-> UTF-8),我得到了这个:

[...]"contract":"Freelance/Indépendant"[...] to 
[...]"contract":"Freelance/Ind??pendant"[...]
Run Code Online (Sandbox Code Playgroud)

Fra*_*nky 5

这实际上按预期返回字符串:

WebClient webC = new WebClient();
webC.Encoding = Encoding.UTF8;
string jsonStr = webC.DownloadString("http://www.express-board.fr/api/jobs");
Run Code Online (Sandbox Code Playgroud)