如何使restsharp使用正确的编码进行响应? [英] How to make restsharp to work with the right encoding for response?
问题描述
我有类似这个问题的问题
RestSharp会忽略响应字符集编码。
I have the same problem like this question RestSharp ignores response charset encoding.
但是没有正确的答案!
像这样的代码
But there is no right answer! Code like this
IRestResponse RSP = client.Execute(request);
不喜欢这样
Encoding encoding = Encoding.GetEncoding("ISO-8859-1");
var result = encoding.GetString(response.RawBytes);
这意味着resetsharp必须使用正确的编码反序列化结果。
有人可以帮忙吗?
It means the resetsharp must deserializ the result with right encoding. Someone can help?
推荐答案
我通过myshelf解决了这个问题
I solved this problem by myshelf
您只需从github上查找代码源并编辑代码
you just down the code source from github and edit the code
stemp 1:找到HttpResponse.cs:
stemp 2:找到Http.cs ,
哦,也许这个解决方案与您不匹配,我的请求结果是这样的,只需像我一样编辑代码,然后它将很好用
[在此处输入图片描述] [3]
stemp 1: find HttpResponse.cs : stemp 2: find Http.cs , Ohm,maybe this solution is not match you,my request result like this,just edit the code like what I do ,then it will work well [enter image description here][3]
这篇关于如何使restsharp使用正确的编码进行响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!