且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

WCF 将消息编码从 Utf-16 更改为 Utf-8

更新时间:2022-12-29 20:16:48

您使用哪种绑定来创建通信渠道?已包含在 CustomBinding 中的 textmessageencoding 元素通常包含 TextEncoding 属性.
https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/wcf/textmessageencoding
WriteEncoding 属性指定用于在绑定上发出消息的字符集编码.有效值为

Which binding do you use to create the communication channel? The textmessageencoding element which has been contained in the CustomBinding generally contains TextEncoding property.
https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/wcf/textmessageencoding
WriteEncoding property specifies the character set encoding to be used for emitting messages on the binding. Valid values are

  • UnicodeFffeTextEncoding:Unicode BigEndian 编码
  • Utf16TextEncoding:Unicode 编码
  • Utf8TextEncoding:8 位编码

默认为 Utf8TextEncoding.该属性属于编码类型.至于具体的绑定,它也包含了 textEncoding 属性.
https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.basichttpbinding.textencoding?view=netframework-4.0
如果有什么我可以帮忙的,请随时告诉我.

The default is Utf8TextEncoding. This attribute is of type Encoding. As for the specific binding, it contains the textEncoding property too.
https://docs.microsoft.com/en-us/dotnet/api/system.servicemodel.basichttpbinding.textencoding?view=netframework-4.0
Feel free to let me know if there is anything I can help with.