+ Start a Discussion
asapjimasapjim 

BillingStreet, carriage return line feeds replaced by spaces

Hi, I have a routine that downloads new and modified account information to local database.  The routine retrieves the information from salesforce using a SOQL query.  The query populates an array of Account objects which are then persisted to the local storage.  For some reason, the billing street is being loaded into the Account object with spaces instead of carriage return line feeds CRLF.

 

This creates a problem if I need to display the information in another program since I cannot determine what data belongs to Address line one vs Address line two.

 

Here's and example of what I am seeing

 

Address entered like this in sales force:

123 Anystreet

Dept. ABC

 

Address appears like this in loaded Account object:

123 Anystreet Dept. ABC

 

So, instead of a CRLF (Dec. 13 + 10)  in between the last "t" in street and "D" in Dept., I am finding a space (Dec. 32)

 

Any help would be greatly appreciated.

 

Thanks!

 

Jim

Best Answer chosen by Admin (Salesforce Developers) 
MrTheTylerMrTheTyler

Hi Jim,

 

  My suspicion is that, as you are using SOAP, this is not a salesforce issue but rather an XML encoding issue.  Forgive me for questioning you but I think it is in your best interest.  Have you  verified that the space character you are seeing is indeed a space character and not a lonely LINEFEED character?  I ask this because my research indicates that XML ( see full article here ) turns CRLF into LF.  My experiences have shown that LF in many text viewers gets rendered simply as a space to the human eye.  If you look at the offending text in a hex editor you may see that you have linefeed in space's clothing.

 

"XML parsed entities are often stored in computer files which, for editing convenience, are organized into lines. These lines are typically separated by some combination of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA).

To simplify the tasks of applications, the XML processor must behave as if it normalized all line breaks in external parsed entities (including the document entity) on input, before parsing, by translating both the two-character sequence #xD #xA and any #xD that is not followed by #xA to a single #xA character. "

 

Kind Regards,

 

Tyler Hudson
Contact Us - We Can Help!

Salesforce Superheroes
------------------------------
help@salesforcesuperheroes.com
www.salesforcesuperheroes.com
1-888-407-9578 x123

All Answers

MrTheTylerMrTheTyler

Hi Jim,

 

  How are you persisting this locally?  That is, are you connecting via the API from .NET or something similar?

 

 

Kind Regards,

 

Tyler Hudson
Contact Us - We Can Help!

Salesforce Superheroes
------------------------------
help@salesforcesuperheroes.com
www.salesforcesuperheroes.com
1-888-407-9578 x123

asapjimasapjim

Hi Tyler, I am connecting via the API using .net.  I am inspecting the values before inserting them to the local (MSSQL) storage.  When I inspect the contents of Account.BillingStreet I am finding that instead of carriage return line feeds I am finding spaces.

 

Any insights would be welcome.

 

Thanks for the reply!

 

 

MrTheTylerMrTheTyler

Hi Jim,

 

  My suspicion is that, as you are using SOAP, this is not a salesforce issue but rather an XML encoding issue.  Forgive me for questioning you but I think it is in your best interest.  Have you  verified that the space character you are seeing is indeed a space character and not a lonely LINEFEED character?  I ask this because my research indicates that XML ( see full article here ) turns CRLF into LF.  My experiences have shown that LF in many text viewers gets rendered simply as a space to the human eye.  If you look at the offending text in a hex editor you may see that you have linefeed in space's clothing.

 

"XML parsed entities are often stored in computer files which, for editing convenience, are organized into lines. These lines are typically separated by some combination of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA).

To simplify the tasks of applications, the XML processor must behave as if it normalized all line breaks in external parsed entities (including the document entity) on input, before parsing, by translating both the two-character sequence #xD #xA and any #xD that is not followed by #xA to a single #xA character. "

 

Kind Regards,

 

Tyler Hudson
Contact Us - We Can Help!

Salesforce Superheroes
------------------------------
help@salesforcesuperheroes.com
www.salesforcesuperheroes.com
1-888-407-9578 x123

This was selected as the best answer
Stephen NewberryStephen Newberry
Hi Jim. We've got the same scenario and same issue. In the last five years have you found a solution to this? Thanks, Steve