荔枝大娘

.Net Core 网络打印机 乱码(伍丰)

电脑版发表于:2020/12/30 14:25

在.net framework 中正常打印 

.Net Core 打印会出现乱码 

原因:.Net Core 默认不支持BG2312

nuget安装  System.Text.Encodings.CodePages


程序启动添加代码

Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

获取编码字节:

Encoding.GetEncoding("GB2312").GetBytes(str);


关于TNBLOG
TNBLOG,技术分享。技术交流:群号677373950
ICP备案 :渝ICP备18016597号-1
App store Android
精彩评论
{{item.replyName}}
{{item.content}}
{{item.time}}
{{subpj.replyName}}
@{{subpj.beReplyName}}{{subpj.content}}
{{subpj.time}}
猜你喜欢