473,703 Members | 2,778 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\nef gh" is not equal to "abcd\r\nefgh". ....

Any ideas why this may happen.

Regards

Jul 20 '05 #1
2 11586
"Karthik.S" <vz************ @NOSPAMverizon. net> wrote in
news:dw******** **********@nwrd dc02.gnilink.ne t:
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\nef gh" 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******** **********@nwrd dc02.gnilink.ne t:

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
9310
by: Canes_Rock | last post by:
The information posted at: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=slrnarv28n.e4j.TuxTrax%40fortress.tuxnet&rnum=1&prev=/groups%3Fq%3Dsuppress%2Bcarriage%2Breturn%2Bgroup:comp.lang.python.*%26hl%3Den%26lr%3D%26ie%3DUTF-8%26group%3Dcomp.lang.python.*%26selm%3Dslrnarv28n.e4j.TuxTrax%2540fortress.tuxnet%26rnum%3D1 seemed to provide a solution to eliminating the line feed and causing a carriage return for the text displayed...
4
18693
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" encoding="UTF-8"?><root><prioritiesTable><description>blah blah blah blah</description></prioritiesTable></root> The important thing here is the which I beleive should be a single
6
17592
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 found some code that MS claims will save a file in unix format and I cut and pasted into my program(and made changes to suit): ..... char ch; char temp="\0"; //Open the file for reading in binarymode. ifstream fp_read(filename.c_str(),...
2
2335
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 when pulling data from an SQL database. The thing that frustrates me the most, is that when I use Enterprise Manager, the carriage returns ARE THERE. It looks fine until I pull it out.
11
8458
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 sb->Append('\r'); and also
6
13538
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
17019
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 that the user puts in (return/enter key) do not show up when the data is retrieved. It is one long line. Is there any way to make the user's paragraph divisions show up in the report?
1
4180
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 data files. Another part of the program distributes the extracted text files to unix systems. Problem first occurred: Opening those files in Unix box shows carriage return in the middle of the record as well as at the end of the record.
11
12594
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 so the user can edit the default email message body before sending the message. But when I populate the large text box (txtBody), I can't get it to include the carriage returns. I've tried vbNewLine, vbCrLf, Chr(10) and Chr(13). I've got the...
0
8743
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8659
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9239
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7844
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5920
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4417
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4674
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2424
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2055
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.