Techie Talks

Sunday, August 19, 2007

Mysterious disappearance of \r in new line during deserialization

I was trying to deserialize an XML into a business object, and found that all my multiline strings have "\n" as the new line character as opposed to the expected "\r\n".

The culprit turned out to be the reader used for deserialization. This issue will go away if XmlTextReader is used to read the xml (instead of TextReader or StreamReader).

Labels: , ,