.NET Webservice = 代理对无效
调用 Web 服务时出现以下抛出错误。除了有人问同样的问题之外,谷歌搜索没有任何结果。
Server was unable to process request. ---> The surrogate pair (0xD860, 0x27) is invalid. A high surrogate character (0xD800 - 0xDBFF) must always be paired with a low surrogate character (0xDC00 - 0xDFFF)."}
System.Exception {System.Web.Services.Protocols.SoapException
Web 服务通过运行视图并打开数据集并读取数据并将其作为格式化 XML 返回,从视图中返回一系列简单的文本字段。
编辑
能够使用以下正则表达式解决此问题,该正则表达式删除恰好是 MSWord/Excel 字符的坏字符
string re = @"[^\x09\x0A\x0D\x20-\xD7FF\xE000-\xFFFD\x10000-x10FFFF]";
return Regex.Replace(text, re, string.Empty);
Getting the following thrown error when calling a web service. Have googled without any results other then people asking the same question.
Server was unable to process request. ---> The surrogate pair (0xD860, 0x27) is invalid. A high surrogate character (0xD800 - 0xDBFF) must always be paired with a low surrogate character (0xDC00 - 0xDFFF)."}
System.Exception {System.Web.Services.Protocols.SoapException
The web service returns a series of simple text fields from a view by running the view and opening a dataset and reading in the data and returning it as formatted XML.
EDIT
Was able to resolve this using the following regex which strips out the bad characters which happened to be MSWord/Excel characters
string re = @"[^\x09\x0A\x0D\x20-\xD7FF\xE000-\xFFFD\x10000-x10FFFF]";
return Regex.Replace(text, re, string.Empty);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能发生的情况是:
эба'
。encoding
声明,因此解析器假定它是 UTF-8。What might be happening is that:
эба'
encoded in IBM866.encoding
declaration, so the parser assumes that it's UTF-8.