分类:
.NET Core
在.net framework 中正常打印
.Net Core 打印会出现乱码
原因:.Net Core 默认不支持BG2312
nuget安装 System.Text.Encodings.CodePages
程序启动添加代码
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
获取编码字节:
Encoding.GetEncoding("GB2312").GetBytes(str);
评价