在 WCF 和 Oracle/Linux 之间使用 ISO-8859-1 编码
我有一个 WCF 服务,可以发送/接收数据并与我的所有 utf-8 客户端完美配合。
但是,我的一位客户正在尝试使用 Oracle 9i/Linux 调用(使用 ISO-8859-1 编码)来访问此服务,而我们在处理特殊字符时遇到了问题。
我无法使用这个< /em>建议的解决方案,因为客户端是Linux,无法安装DLL。
基于这种情况,有人可以建议我另一个解决方案(可能涉及客户端、服务或两者的更改)吗?
提前致谢。
I have a WCF service that send/receives data and work perfectly with all my utf-8 clients.
But, one of my customers is trying to access this service with a Oracle 9i/Linux call, that works with ISO-8859-1 encoding, and we are having problems with special characters.
I can't use this suggested solution, since the client is Linux and cannot install DLLs.
Based on this scenario, can anyone please suggest me another solution (wich can involve changes in the client, in the service or in both)?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该解决方案(使用 CustomTextEncoder)也应该适用于您的场景吗? Linux 客户端可以继续发送它喜欢的数据(即,在 iso-8859-1 中),并且仅在服务器上使用的编码器将能够读取它。然后编码器可以决定如何将响应编码返回客户端(UTF-8 或再次 iso-8859-1)。
如果您也希望响应采用 iso-8859-1 格式,您可能还需要消息检查器之类的东西来使用适当的字符集更新内容类型标头。
更新:使用 ISO-8859-1 的自定义编码器示例
That solution (using the CustomTextEncoder) should work in your scenario as well? The linux client can continue sending the data as it pleases (i.e., in iso-8859-1), and the encoder, used on the server only, would be able to read it. The encoder then can decide how to encode the response back to the client (UTF-8 or iso-8859-1 again).
If you want the response to be in iso-8859-1 as well you may also need something like a message inspector to update the content-type header with the appropriate charset.
Update: example with the custom encoder using ISO-8859-1