【问题标题】:Send UTF-8 character to WCF service将 UTF-8 字符发送到 WCF 服务
【发布时间】:2010-01-13 12:43:48
【问题描述】:

如何配置 WCF 服务/客户端以向服务发送 UTF-8 字符? 我想发送类似“ţşîăâăâşţŞŢĂΔ的挪威语、芬兰语、罗马尼亚语文本 我的绑定是这样的:

  <basicHttpBinding>
        <binding name="myBindingConfiguration" receiveTimeout="00:21:00"
          maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"   messageEncoding="Text"

                 transferMode="Buffered"
                 useDefaultWebProxy="true"
                 textEncoding="utf-8"
                 >
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None"/>
        </binding>
      </basicHttpBinding>

【问题讨论】:

  • 您能告诉我们是什么让您认为这不起作用吗?例如。您是否收到错误消息,或者数据是否以某种方式损坏?
  • 对不起,这是我的错误,服务和客户端以 UTF8 格式获取消息,但是当我在我的服务/客户端控制台中显示它们时,特殊字符看起来不像是发送的那样。如果我发送“îăşţ”,它会出现在控制台“îast”中,这就是它所欺骗的,只有在调试中我看到服务/客户端正确接收它们,但在控制台中我看到不同。
  • 默认UTF-8文本编码?

标签: .net wcf encoding utf-8 wcf-configuration


【解决方案1】:

无需配置。 basicHttpBinding 已经默认使用 UTF-8 文本编码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-31
    • 2016-03-26
    • 1970-01-01
    • 2014-11-30
    • 1970-01-01
    • 2016-06-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多