Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an ASP.net application that saves a multi-line text box to SQL. We've found that when the user puts line breaks into the text, they are saved as the LF character, not CR/LF.

This doesn't matter for our application, as it inserts the
character correctly when it displays, but other applications that use the data are looking for the CR/LF character combination specifically.

Does anyone know why the LF character would be used, as opposed to CR/LF? Is that a configurable item?

Text that is entered like this:

line 1

line 2
line 3

Is saved like this (using (LF) to show the line feed):
Line 1(LF)(LF)Line 2(LF)Line 3(LF)


What I have tried:

I've tried Googling the answer, but haven't found anything specific to my case.
Posted
Updated 2-Dec-21 3:58am
v3

1 solution

So what does the sequence look like when you're saving the text to the database?

It's fairly easy to normalize that text before you save the data, though it's not a configurable setting. This is how web browsers work, and you have to write your code accordingly.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900