By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,137 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

carriage return/new line comparison

P: n/a
I have a text area in my webpage where i allow people to format their
data in to multiple paragraphs. I store this data in the database and
display it in a similar textarea to keep the formatting the same.

The javascript i use to construct a xml document of all the changed data
in my webpage compares the data in the textarea to data stored in an xml
data island. Whenever the data has these carriage returns or new line
("\r\n") it always thinks that the data has changed. so

"abcd\r\nefgh" is not equal to "abcd\r\nefgh".....

Any ideas why this may happen.

Regards

Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Karthik.S" <vz************@NOSPAMverizon.net> wrote in
news:dw******************@nwrddc02.gnilink.net:
I have a text area in my webpage where i allow people to format their
data in to multiple paragraphs. I store this data in the database and
display it in a similar textarea to keep the formatting the same.

The javascript i use to construct a xml document of all the changed data
in my webpage compares the data in the textarea to data stored in an xml
data island. Whenever the data has these carriage returns or new line
("\r\n") it always thinks that the data has changed. so

"abcd\r\nefgh" is not equal to "abcd\r\nefgh".....

Any ideas why this may happen.


XML parsers normally (hehe!) normalize any combination of CR (usually
represented as \r) and LF (usually represented as \n) in text to a single
LF (\n). So your stored data is probably actually "abcd\nefgh". If that's
the problem, removing any \r's from the textarea data should solve it.
Jul 20 '05 #2

P: n/a
Yep. That did the trick.

Thanks a lot.

Eric Bohlman wrote:
"Karthik.S" <vz************@NOSPAMverizon.net> wrote in
news:dw******************@nwrddc02.gnilink.net:

I have a text area in my webpage where i allow people to format their
data in to multiple paragraphs. I store this data in the database and
display it in a similar textarea to keep the formatting the same.

The javascript i use to construct a xml document of all the changed data
in my webpage compares the data in the textarea to data stored in an xml
data island. Whenever the data has these carriage returns or new line
("\r\n") it always thinks that the data has changed. so

"abcd\r\nefgh" is not equal to "abcd\r\nefgh".....

Any ideas why this may happen.

XML parsers normally (hehe!) normalize any combination of CR (usually
represented as \r) and LF (usually represented as \n) in text to a single
LF (\n). So your stored data is probably actually "abcd\nefgh". If that's
the problem, removing any \r's from the textarea data should solve it.


Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.