据我了解... RestSharp序列化器的输出始终为String。 .Net将字符串定义为使用UTF-16的字符集合。因此,没有办法修改请求的编码,因此我可以对其进行更改,标头将被更改,例如XML标头将为UTF-8,但是请求的编码将始终为String,因此它将是UTF-16。
https://docs.microsoft.com/en-gb/dotnet/api/system.string?view=netframework-4.8
using System;namespace RestSharp.Serializers
{
public interface ISerializer
{
string ContentType { get; set; }
string Serialize(object obj);
}
}
答案 0 :(得分:0)
已解决:我找到了解决方案。 Client.Encoding属性设置编码,检查用于设置请求中字节的RestSharp代码。