小编Wil*_*ied的帖子

Web请求C#获取的带有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)

c# string encoding json

0
推荐指数
1
解决办法
1022
查看次数

标签 统计

c# ×1

encoding ×1

json ×1

string ×1