473,225 Members | 958 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,225 software developers and data experts.

String processing bug in .net 2?

There's an automated email an application generates, that we've found a
wierd processing bug(?) with in .net 2.0

The app has the following lines. There are 20 lines above that use
"\n\r" that wrap just fine:

[20] message.Body += "EONE\n\r";
[21] message.Body += "Name [{0}] Reg# [{1}] Owner [{2}]\n\r";
[22] message.Body += "Association [{1}] ADOwner [{4}] \n\r";

and then mails the message. The wierd part is line 20 processes the
"\n\r" and wraps the line however, the "\n\r" are ignored on lines 21
and 22. The line comes out in a single continuous line. The [(0)]'s
need to be in there for an application to process the message. If I
remove the [(0)]'s the line wraps! Putting them back in the lines does
not wrap.

What would c# be doing with the "[(0)]" as it shouldn't try to process
them. With the [(0)] it doesn't process the "\n\r" and without the
[(0)] it works fine. Wierd eh?

Jan 25 '06 #1
5 1068
Maybe its something that is being fed into those place holders later on
that is screwing it up?
Does it also happen if you use Environment.NewLine instead?
Is the email message HTML ? Could you use <br> instead to get around
your problem?
When the line doesn't wrap, does it actually print the \n\r?

Jan 25 '06 #2
<gr***********@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
There's an automated email an application generates, that we've found a
wierd processing bug(?) with in .net 2.0

The app has the following lines. There are 20 lines above that use
"\n\r" that wrap just fine:


Shouldn't that be \r\n?

Michael
Jan 25 '06 #3
gr***********@gmail.com <gr***********@gmail.com> wrote:
There's an automated email an application generates, that we've found a
wierd processing bug(?) with in .net 2.0

The app has the following lines. There are 20 lines above that use
"\n\r" that wrap just fine:

[20] message.Body += "EONE\n\r";
[21] message.Body += "Name [{0}] Reg# [{1}] Owner [{2}]\n\r";
[22] message.Body += "Association [{1}] ADOwner [{4}] \n\r";

and then mails the message. The wierd part is line 20 processes the
"\n\r" and wraps the line however, the "\n\r" are ignored on lines 21
and 22. The line comes out in a single continuous line. The [(0)]'s
need to be in there for an application to process the message. If I
remove the [(0)]'s the line wraps! Putting them back in the lines does
not wrap.

What would c# be doing with the "[(0)]" as it shouldn't try to process
them. With the [(0)] it doesn't process the "\n\r" and without the
[(0)] it works fine. Wierd eh?


Well for a start, using "\n\r" is very odd - you should be using
"\r\n". However, if you don't believe that to be the issue, could you
post a short but complete program which demonstrates the problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jan 25 '06 #4
Hi,

<gr***********@gmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
There's an automated email an application generates, that we've found a
wierd processing bug(?) with in .net 2.0

The app has the following lines. There are 20 lines above that use
"\n\r" that wrap just fine:

[20] message.Body += "EONE\n\r";
[21] message.Body += "Name [{0}] Reg# [{1}] Owner [{2}]\n\r";
[22] message.Body += "Association [{1}] ADOwner [{4}] \n\r";


I n addition to the others comments you better use StringBuilder to create
your message, in the current form you are generating lots of strings for no
reason

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jan 25 '06 #5
Since I took over this project I was swapping the design over to
stringbuilder but I simply haven't gotten to this part yet. I'll cut
down the code ( from the 300+ message.body += statements) to a 5 line
example and post it.

Jan 25 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: M | last post by:
Hi, I've searched through the previous posts and there seems to be a few examples of search and replacing all occurrances of a string with another string. I would have thought that the code...
3
by: Paul H | last post by:
I have a text file that contains the following: ******************** __StartCustomerID_41 Name: Fred Smith Address: 57 Pew Road Croydon
6
by: Alexander Muylaert | last post by:
Hi Does anyone know a good starting point about high speed string processing in C#? What I need is a very fast routine for a case insensitive "contains". e == E == == == ... Kind...
12
by: Joe Fallon | last post by:
I would like to know the syntax to check that an Object is a String. If it was a number test I might use IsNumeric. But there is no function: IsString (is there?) -- Joe Fallon
9
by: Joel Finkel | last post by:
Is there a way to execute a method if all we know is its name as a string? Let's say we have the following class. What is the code for the Execute method? I need a solution that works with the...
23
by: comp.lang.tcl | last post by:
I have a TCL proc that needs to convert what might be a list into a string to read consider this: ]; # OUTPUTS Hello World which is fine for PHP ]; # OUTPUT {{-Hello}} World, which PHP...
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
3
by: asclearuc | last post by:
Hello Is it possible to use map<string&, string&>? Why I need it. I have a large amount of data obtained from XML file. I should do processing of this data. The processing takes many...
5
by: mloraditch | last post by:
All, I have some C# code doing some form processing for me. Some forms have a certain control, some don't. If the control exists i need to do some processing on it later. Of course when i try to...
2
by: YASIN786 | last post by:
hi all i am helping a friend to develop a java program to implement the following features but i cannot understand how to go about this problem. A text file contains a number of English...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.