8.7K Star 14.3K Fork 4.2K

GVPdotNET China/Furion

 / 详情

📝 修复远程请求接口如果是 `gbk` 编码导致序列化中文出现乱码

Done
owner
Opened this issue  
2022-09-13 18:13

功能描述

使用远程请求过程中,如果目标地址响应报文内容格式为 charset=gbk 且包含中文,则反序列化后出现乱码。

相关资料

输入图片说明

输入图片说明

复现代码

public class GetAaddrOutput
{
    public string Ip { get; set; }
    public string pro { get; set; }
    public string proCode { get; set; }
    public string city { get; set; }
    public string cityCode { get; set; }
    public string region { get; set; }
    public string regionCode { get; set; }
    public string addr { get; set; }
    public string regionNames { get; set; }
    public string err { get; set; }
}
var result = await "http://whois.pconline.com.cn/ipJson.jsp?json=true".GetAsAsync<GetAaddrOutput>();

功能清单

  • 修改所有 xxxAsStreamAsync 方法返回签名,除了返回 Stream 以外还返回 Encoding 编码
  • 修复 xxxAsAsync<T> 包含 gbk 中文序列化乱码问题
  • 更新 远程请求文档
  • 编写更新日志内容

期望效果

// 返回元组
var (stream, encoding) = await "https://www.furion.icu/".GetAsStreamAsync();

// 包含序列化正常
var result = await "http://whois.pconline.com.cn/ipJson.jsp?json=true".GetAsAsync<GetAaddrOutput>();

代码实现

https://gitee.com/dotnetchina/Furion/commit/258a9b3432bba909778c8c22408f8d787841f330

Comments (1)

百小僧 created任务 3 years ago
百小僧 set assignee to 百小僧 3 years ago
百小僧 added
 
优化
label
3 years ago
百小僧 added
 
新功能
label
3 years ago
百小僧 added
 
重大调整
label
3 years ago
百小僧 added
 
漏洞
label
3 years ago
百小僧 set milestone to v4.4.3 3 years ago
百小僧 set branch to v4 3 years ago
百小僧 set deadline to 2022-09-14 3 years ago
百小僧 set start time to 2022-09-13 3 years ago
百小僧 changed deadline from 2022-09-14 to 2022-09-13 3 years ago
百小僧 set top level to Medium 3 years ago
百小僧 set priority to Secondary 3 years ago
百小僧 changed description 3 years ago
Expand operation logs
百小僧 changed issue state from 待办的 to 已完成 3 years ago
百小僧 changed top level from Medium to Not top 3 years ago
百小僧 related pull requestdotNET China/Furion Pull Request !569 3 years ago
百小僧 translation missing: en.project.new_issues_operate_log.link_issue(Normal)📝 发布 Furion v4.4.9 版本 3 years ago

Sign in to comment

Status
Assignees
Milestones
Pull Requests
Successfully merging a pull request will close this issue.
Branches
Planed to start   -   Planed to end
-
Top level
Priority
参与者(1)
974299 monksoul 1578937227
C#
1
https://gitee.com/dotnetchina/Furion.git
git@gitee.com:dotnetchina/Furion.git
dotnetchina
Furion
Furion

Search