views:

330

answers:

2

I a class containing multiple properties of type string. One of the values contains a character of hex value 96. If I serialize the class to xml, the xml serializer does not encode that character, and if I view the xml in various tools such as IE or SQLServer with OpenXML, it complains that the character is invalid in an xml document. Shouldn't the xml serializer be encoding this character?

+1  A: 

This may help (caveat - found through search engine, untested): .NET Web Services Fail on Unicode Control chars

Basically it says that the XmlSerializer fails on deserializing Unicode control characters.

In the comments, one of the posters links to Hexadecimal value 0x is an invalid character. 0x96 isn't listed there, so I'm not sure that this is the same issue.

TrueWill
A: 

I was able to work around the error by changing the encoding to iso-8859-1. In my case, that code page included all the characters that my data consumed. I think theoretically it may be possible for the data to contain other characters but this is a suitable work around.

Jeremy