473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

carriage return/new line comparison

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
2 11577
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Canes_Rock | last post by:
The information posted at: ...
4
by: Josh | last post by:
Hi, I'm using System.Data.DataSet.ReadXml to convert some xml from a webservice to a DataSet. The xml looks like: <?xml version="1.0"...
6
by: Laura D | last post by:
How can I identify a carriage return in C++? \r, \f, \0, \n, \t does not work. I have also tried !isprint(ch), iscntrl(ch), isspace(ch), etc....with no luck! I even poked around in the MSDN and...
2
by: Matt Mercer | last post by:
Hi all, I am having a frustration problem, and I have read about 25 newsgroup postings that do not have a satisfying answer :) The problem appears to be common where carriage returns are lost...
11
by: TheRain | last post by:
Hi, I am trying to append a carriage return to my string using the string builder class, but when I do this the string ends up containing "13". I tried this multiple ways like so ...
6
by: shajias | last post by:
Hi, I am having a xml code like this <name> I am having a carriage return here. Second line with carriage return. This is the last line. </name>
2
by: dancer | last post by:
Using ASP.Net and VB.net I have textboxes (<asp:textbox id......>) in which the user will be entering paragraphs. They are multiline (several rows and several columns). The carriage returns...
1
by: nur123 | last post by:
Thanks in advance who will look at it. I have been encountering an issue which I can’t find a way out of it. What my pgm does: It (java codes) reads oracle table data and creates flat text...
11
by: evenlater | last post by:
My db allows the user to send email via CDO. The body of the email is determined in code. I have built an email form with To, CC and Subject lines and a large text box for the body of the message...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.