RE: Invalid high surrogate character (0xDEB6).

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks for your reply Dave,

I think it would be better to identify those nodes that may contains the
pontential problemtic data. Sure, you can perform an additional encoding on
the data so as to ensure it is proper unicode text range.

As you mentioned that all the data is of ASCII char, how were those ASCII
chars generated and embeded into the XML document?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

From: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= <thielen@xxxxxxxxxxxxx>
References: <BEFB912D-04CF-4210-BEA8-5CBA8964E270@xxxxxxxxxxxxx>
<JT7PTWUaIHA.1500@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE: Invalid high surrogate character (0xDEB6).
Date: Wed, 6 Feb 2008 21:05:01 -0800


My problem is I don't control the text that goes in many of the nodes &
attributes. Should I be encoding the text somehow? I assumed using the
XmlDocument methods that it would handle any necessary encoding.

Also, all of the text added in this case is ASCII.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm




"Steven Cheng[MSFT]" wrote:

Hi Dave,

As for the "Invalid high surrogate character" error you encountered, it
is
due to some Unicode specific validation in .NET XML API. Within the .Net
framework, there are lot of string validations for Unicode, not only for
XML. So, this is the correct behaviour.The problem is that the data in
the
XML you generated may contains some certain value that is valid in
string
or XML, but not valid for UNICODE(utf-16 which has rules for surrogate).

From some former issue, I found that you may encounter this error when
you've encrypted some of the data in the xml which may cause the
generated
value be invalid according to unicode surrogate pair rules. Is there
any
particular data included in your XML document? You can try simplify the
XML
document so as to locate the certain data fragment.

BTW, here is a blog article I've found which also mentioned this:

http://blogs.msdn.com/michkap/archive/2006/12/05/1212917.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each
follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach
the
most efficient resolution. The offering is not appropriate for
situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are
best
handled working with a dedicated Microsoft Support Engineer by
contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no
rights.
--------------------
From: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= <thielen@xxxxxxxxxxxxx>
Subject: Invalid high surrogate character (0xDEB6).
Date: Wed, 6 Feb 2008 17:25:01 -0800


I am building an XML document using the standard calls to create
elements
and
attributes. Occasionally I get the following when calling
xmlDoc.OuterXml.
What's going on and how do I avoid this?

System.ArgumentException occurred
Message="Invalid high surrogate character (0xDEB6). A high surrogate
character must have a value from range (0xD800 - 0xDBFF)."
Source="System.Xml"
StackTrace:
at System.Xml.XmlTextEncoder.Write(String text)
at System.Xml.XmlTextWriter.WriteString(String text)
at System.Xml.XmlText.WriteTo(XmlWriter w)
at System.Xml.XmlAttribute.WriteContentTo(XmlWriter w)
at System.Xml.XmlAttribute.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteContentTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteContentTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteContentTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteContentTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteContentTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlElement.WriteContentTo(XmlWriter w)
at System.Xml.XmlElement.WriteTo(XmlWriter w)
at System.Xml.XmlDocument.WriteContentTo(XmlWriter xw)
at System.Xml.XmlDocument.WriteTo(XmlWriter w)
at System.Xml.XmlNode.get_OuterXml()
at
net.windward.autotag.DocumentDataBuffer.SaveProfileToDoc(DocGlobal
docData, String docFileName) in

C:\src\kahuna\AutoTag\AutoTagCore\net\windward\autotag\DocumentDataBuffer.c
s:line 116


--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm







.



Relevant Pages

  • Re: Problems with special characters in XML
    ... i would guess that your problem is to do with the HTTP encoding. ... your web service is sending a HTTP header specifying UTF-8 encoding (which ... the XML document is able to read out the encoding ...
    (microsoft.public.dotnet.xml)
  • Re: [ANN] pyxser-1.2r --- Python-Object to XML serialization module
    ... the user defined encoding as is passed to the serialization ... now Unicode strings are serialized as encoded byte string ... by using the encoding that the user pass as enc parameter to the ... You mean, the whole XML document is serialised with that encoding, right? ...
    (comp.lang.python)
  • Re: Xml Encoding Problem!!!
    ... I have an xml document which gets generated out of a process with ... Not sure what you're doing in that code - the StreamWriter should have ... a UTF-8 encoding by default. ...
    (microsoft.public.dotnet.languages.csharp)
  • encoding="ISO-8859-1" and XML (.Net CF)
    ... and I'm trying to load an XML document that has a first ... I'm loading this via XmlDocument.Load. ... Additional information: XmlException ... It looks like the problem is with the encoding. ...
    (microsoft.public.dotnet.xml)
  • Re: What is wrong? The minidom or the XML file?
    ... You said you pasted Chinese characters into the XML document. ... They need to be in the same encoding as ... \__/ All the gods are dead except the god of war. ...
    (comp.lang.python)