Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 497193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:45:29+00:00 2026-05-13T05:45:29+00:00

Situation : When I deserialize XML that contains carriage returns, the characters appear as

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:45:29+00:00Added an answer on May 13, 2026 at 5:45 am

    Another approach is to use the XmlAttribute(), as mentioned here. For example:

    Imports System.Xml.Serialization
    
    Public Class ApplicationOptions
    
        Private _someText As String = String.Empty
    
        <XmlAttribute()> _
        Public Property SomeText() As String
            Get
                Return _someText
            End Get
            Set(ByVal value As String)
                _someText = value
            End Set
        End Property
    
    End Class
    

    I just tried it on a sample app and the linefeed characters were not replaced during de-serialisation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Situation is a string that results in something like this: <p>This is some text
Situation: I've got a SVN repository with lets say 100 revisions, rev. 100 being
Situation: multiple front-ends (e.g. Silverlight, ASP) sharing a single back-end server (WCF RIA or
Situation Say I have the following: a table items a table lists to which
Situation I'm using matchbox keyboard which is X11 based application. When any application is
Situation: We've got this DIV with thumbnails who need their src being changed on
Situation I'm creating a C#/WPF 4 application using a SQL Compact Edition database as
This might be a little subjective, but I'd like to get your input on
Lets say I have business class: public class Foo { public int Prop1 {get;set;}
I have a client and a server application which communicate over .NET 2.0 Remoting

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.