📜  .net 返回结果编码为 utf8 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:57.785000             🧑  作者: Mango

代码示例1
private async Task ResponseMessageAsync(HttpResponseMessage result)
{
    string message = await result.Content.ReadAsStringAsync();
    string parsedString = Regex.Unescape(message);
    byte[] isoBites = Encoding.GetEncoding("ISO-8859-1").GetBytes(parsedString);
    return Encoding.UTF8.GetString(isoBites, 0, isoBites.Length);
 }