views:

112

answers:

1

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.

A: 

What might be happening is that:

  • The XML file contains the bytes ED A1 A0 27. According to chardet, this was most likely intended to be эба' encoded in IBM866.
  • But it lacks an encoding declaration, so the parser assumes that it's UTF-8.
  • The text gets decoded into the UTF-16 string D860 0027.
  • This string is not valid UTF-16 because of the unpaired surrogate D860, so you get the exception.
dan04
Interesting. How do you know this?
John Saunders