Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Odd Squares In Textbox Controls


  • Please log in to reply
1 reply to this topic

#1 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer


  • Malware Response Team
  • 12,301 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:11:19 AM

Posted 26 June 2008 - 11:13 PM

Hello.

I have a program that saves a textbox to a file using XML.Serialization.XMLSerializer.
The saving and loading work correctly.
Problem is, when I display the string from the load operation, there are little square characters that appear in the textbox where newlines should be.

I am using Visual Basic.NET 2008

Anyone else had this problem before?

I at first thought the deserialization process might have ate some of the newlines or loaded them incorrectly (i.e., CR or LF instead of CRLF). However, if I copy the contents of the textbox to any other program, they return CRLF, just as the string should be.

Here's a more visual example of what I mean. Here's the original:
Posted Image

After saving and loading that file, I get this instead:
Posted Image

Thanks in advance!!

Billy3

Edited by Billy O'Neal, 26 June 2008 - 11:16 PM.

Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image

BC AdBot (Login to Remove)

 


m

#2 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer

  • Topic Starter

  • Malware Response Team
  • 12,301 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:11:19 AM

Posted 26 June 2008 - 11:46 PM

Nevermind... I got it figured out...

My old save/load functions used the "FileStream" overloads of xml serializer. If I use XMLTextWriter instead, it respects the character encoding in the file, and therefore gets the newlines correctly.

Thanks anyway!

Billy3
Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users