Situation: When I deserialize XML that contains carriage returns, the characters appear as unprintable character "boxes" rather than as carriage returns.
Background: User input collected via a multi-line textbox contains carriage returns within the text. I am persisting this text data to XML using the .NET XML serializer (snippet below). When I later de-serialize the XML data and bind it back to the multi-line textbox, the carriage return characters render as unprintable "boxes".
I know Windows uses a carriage return + line feed to indicate an end-of-line. I think that the XML serializing may be altering the data (possibly stripping the carriage return?).
Question: Any ideas how can I get the deserialized carriage returns to render properly?
Thanks in advance, -Ed
Serialization Snippet
Public Sub SaveApplicationOptions(ByVal AppOptions As ApplicationOptions) Implements IApplicationOptionsRepository.SaveApplicationOptions
Dim serializer As New XmlSerializer(GetType(ApplicationOptions))
Dim ApplicationOptionsFilename As String = ConfigurationManager.AppSettings("ApplicationOptionsXML")
Dim sw As New StreamWriter(ApplicationOptionsFilename)
serializer.Serialize(sw, AppOptions)
sw.Close()
sw.Dispose()
End Sub