locked
The surrogate pair is invalid. RRS feed

  • Question

  •  

    I got the error ("The surrogate pair is invalid.") from a web service which retrieves data from oracle database. the error occured while generating the xml document.

    The data is loaded into the database from flat files which are received from various users from different locations (Korea,japan etc.) How do i set the culture in the webservice to prevent this issue?

    could be of some help if a sample is provided.
     
    I tried disabling the session but i still get the same error.
    Below is the exact error message that i get from the web service.

    "There was an error generating the XML document. ---> The surrogate pair (0xD86E, 0x79) is invalid. A high surrogate character (0xD800 - 0xDBFF) must always be paired with a low surrogate character (0xDC00 - 0xDFFF).".
     
    It just happens with few users from those 2 countries they submit data in Korean and Japanese languages, all the other customers are from US and UK.

    Thanks in advance...
    Thursday, January 3, 2008 8:40 AM

All replies

  • It's not clear to me that the culture has anything to do with this. I suggest you try using the same code to read from the database and create the XML document, but call it from a WinForms or console application. I bet you get the same problem.

     

    You may simply have bad data in the database.

    Thursday, January 3, 2008 1:06 PM
    Moderator
  • Yes, the problem is while generating the XML document, but how do i handle this? i am able to see the data in the dataset but when i return the dataset in web service it results in the error (The surrogate pair is invalid).

     

    Please let me know if there is a way to handle the issue.

    Friday, January 4, 2008 9:05 AM
  • First of all, you should simplify the situation. The problem probably has nothing to do with the fact that it occurs in a web service. So, separate out the code that loads the XML file and call that code from a console application. If the problem still occurs in the console application, you'll have eliminated the "web service" factor as well as producing a piece of code that is easier to debug (no client will be required).

     

    Next, you may need to consider the possibility that the data in the database is actually bad. You will want to debug the console application and set a breakpoint before the XmlDocument is loaded. Get the XML into a string variable that you can examine. You may actually need to figure this out byte by byte. See if you can cause similar (but shorter) data to be created in the database.

     

    Good luck!

     

    Friday, January 4, 2008 12:19 PM
    Moderator
  • Hi, I have the same issue.
    in my case it is a sharepoint search service which fails. the data returned is a dataset of search results representing found documents. the particular field which fails is a computed field called hithighlightedsummary, the service fails when try to create an xml document to send back.
    i can create my own service and use the sharepoint search api, then create a non xml structure to send to my client, but i would like to find a better solution.
    any ideas?
    Tuesday, August 18, 2009 7:42 AM