473,395 Members | 1,471 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,395 software developers and data experts.

trimmed string after replace function

Hi,

I have a mystery to solve. It is a mystery because it happens randomly.
In the ASP page that is in question, I build a large string (no more
than 10K) which is basically an email template in HTML format. Then I
replace the parts with the values, which are also strings with the size
of 1-2 KB.

For example:

order_summary = generateOrderSummary() 'This HTML string is no more
than 4-5 KB

send_email (order_summary, to_sales_department) 'This email goes to
sales dept, they receive it OK.

email_body = readFromFile("HTML_email_template.html") ' This is 10KB

email_body = replace (email_body, "<!-- NAME -->", billing_name)

email_body = replace (email_body, "<!-- ORDER SUMMARY -->",
order_summary)

email_body = replace (email_body, "<!-- OTHER -->", other_stuff)

send_email (email_body, to_customer) ' They sometimes receive trimmed
order summary.

Here is the mystery: sometimes recipients complain that their order
confirmation is wrong because it seems order_summary part is trimmed.
They fw me the email and yes it was trimmed, however the rest of the
email is OK: just the order_summary in the middle of the email was
messed up. Since order_summary shows OK on the first email, and not on
the second email I concluded that there must be something with the
replace function. It doesn't happen a lot, there are only 2 known cases
out of couple thousands. It is not order-specific either, I place the
same order and order_summary shows OK.

Any suggestions on how to isolate the problem?
Have you encountered the same/similar problems with strings?

I use ASP 3.0 on IIS 6.0. Server is Windows 2003.

Thanks

Deniz

Jan 15 '07 #1
7 1920

"denoxis" <go****@deniznet.comwrote in message
news:11*********************@s34g2000cwa.googlegro ups.com...
Hi,

I have a mystery to solve. It is a mystery because it happens randomly.
In the ASP page that is in question, I build a large string (no more
than 10K) which is basically an email template in HTML format. Then I
replace the parts with the values, which are also strings with the size
of 1-2 KB.

For example:

order_summary = generateOrderSummary() 'This HTML string is no more
than 4-5 KB

send_email (order_summary, to_sales_department) 'This email goes to
sales dept, they receive it OK.

email_body = readFromFile("HTML_email_template.html") ' This is 10KB

email_body = replace (email_body, "<!-- NAME -->", billing_name)

email_body = replace (email_body, "<!-- ORDER SUMMARY -->",
order_summary)

email_body = replace (email_body, "<!-- OTHER -->", other_stuff)

send_email (email_body, to_customer) ' They sometimes receive trimmed
order summary.

Here is the mystery: sometimes recipients complain that their order
confirmation is wrong because it seems order_summary part is trimmed.
They fw me the email and yes it was trimmed, however the rest of the
email is OK: just the order_summary in the middle of the email was
messed up. Since order_summary shows OK on the first email, and not on
the second email I concluded that there must be something with the
replace function. It doesn't happen a lot, there are only 2 known cases
out of couple thousands. It is not order-specific either, I place the
same order and order_summary shows OK.

Any suggestions on how to isolate the problem?
Have you encountered the same/similar problems with strings?
It has been known that if the html body part of the email is not encoded
using quoted-printable encoding that white space gets inserted into html tag
names. When that happens the html output gets messed up.

I use ASP 3.0 on IIS 6.0. Server is Windows 2003.

Thanks

Deniz

Jan 15 '07 #2
denoxis wrote:
Any suggestions on how to isolate the problem?
Have you encountered the same/similar problems with strings?
What happens when you change this...
email_body = replace (email_body, "<!-- ORDER SUMMARY -->",
order_summary)
....to this?

email_body = replace(email_body, "<!-- ORDER SUMMARY -->",
Server.HTMLEncode(order_summary))

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Jan 16 '07 #3
If I do that I see the HTML source in the email! Doesn't HTMLEncode
change "<" to &lt; and ">" to &gt; etc? I don't want that, my email
*is* in HTML, I want to keep the tags so my email would be formatted
accordingly.

Deniz

Dave Anderson wrote:
denoxis wrote:
Any suggestions on how to isolate the problem?
Have you encountered the same/similar problems with strings?

What happens when you change this...
email_body = replace (email_body, "<!-- ORDER SUMMARY -->",
order_summary)

...to this?

email_body = replace(email_body, "<!-- ORDER SUMMARY -->",
Server.HTMLEncode(order_summary))

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Jan 16 '07 #4
denoxis wrote:
> email_body = replace(email_body, "<!-- ORDER SUMMARY -->",
Server.HTMLEncode(order_summary))

If I do that I see the HTML source in the email! Doesn't HTMLEncode
change "<" to &lt; and ">" to &gt; etc? I don't want that, my email
*is* in HTML, I want to keep the tags so my email would be formatted
accordingly.
Right. But you did not try, so you did not find out if your content is
actually present.

I made the suggestion so you could determine whether you were simply guilty
of writing sloppy HTML in the affected section. NOT VISIBLE does not equal
NOT THERE when it comes to HTML, after all. I suppose you can still [view
source] on the offending messages if you want to know for sure.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Jan 17 '07 #5

Dave Anderson wrote:
denoxis wrote:
email_body = replace(email_body, "<!-- ORDER SUMMARY -->",
Server.HTMLEncode(order_summary))
If I do that I see the HTML source in the email! Doesn't HTMLEncode
change "<" to &lt; and ">" to &gt; etc? I don't want that, my email
*is* in HTML, I want to keep the tags so my email would be formatted
accordingly.

Right. But you did not try, so you did not find out if your content is
actually present.
I appreciate the suggestion, I did try it before I post my answer and
that's what I saw: piece of HTML source code in the middle of HTML
email, which would show correctly if it was real HTML. I thought you
suggested that those codes would translate back to normal HTML in the
email.
I made the suggestion so you could determine whether you were simply guilty
of writing sloppy HTML in the affected section. NOT VISIBLE does not equal
NOT THERE when it comes to HTML, after all. I suppose you can still [view
source] on the offending messages if you want to know for sure.
Sloppy HTML is less likely since it is generated in a loop for each
product. Something like:
....
"<tr><td>" & product_name & "</td><td>" & price & "</td><td>" & qty &
"</td></tr>"
....
I did make sure product names don't contain weird characters (such as <
and >) By looking at the source code of the email that is in question,
I see part of the HTML is missing with no trace

I did however one thing: adding linebreaks in the HTML-generating loop
(otherwise there could be a very long line depending on the order size,
which is actually reason of some of the bounce-backs) So maybe it is
line-length related issue. We will see if adding '& vbcrlf' to the end
of the code above helps.

Thanks for the answers

Deniz
>
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Jan 18 '07 #6

"denoxis" <go****@deniznet.comwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
>
Dave Anderson wrote:
denoxis wrote:
> email_body = replace(email_body, "<!-- ORDER SUMMARY -->",
> Server.HTMLEncode(order_summary))
>
If I do that I see the HTML source in the email! Doesn't HTMLEncode
change "<" to &lt; and ">" to &gt; etc? I don't want that, my email
*is* in HTML, I want to keep the tags so my email would be formatted
accordingly.
Right. But you did not try, so you did not find out if your content is
actually present.

I appreciate the suggestion, I did try it before I post my answer and
that's what I saw: piece of HTML source code in the middle of HTML
email, which would show correctly if it was real HTML. I thought you
suggested that those codes would translate back to normal HTML in the
email.
I made the suggestion so you could determine whether you were simply
guilty
of writing sloppy HTML in the affected section. NOT VISIBLE does not
equal
NOT THERE when it comes to HTML, after all. I suppose you can still
[view
source] on the offending messages if you want to know for sure.

Sloppy HTML is less likely since it is generated in a loop for each
product. Something like:
...
"<tr><td>" & product_name & "</td><td>" & price & "</td><td>" & qty &
"</td></tr>"
...
I did make sure product names don't contain weird characters (such as <
and >) By looking at the source code of the email that is in question,
I see part of the HTML is missing with no trace

I did however one thing: adding linebreaks in the HTML-generating loop
(otherwise there could be a very long line depending on the order size,
which is actually reason of some of the bounce-backs) So maybe it is
line-length related issue. We will see if adding '& vbcrlf' to the end
of the code above helps.
Have you yet confirmed whether the HTML body part is being encoded as
quoted-printable. I said this already but you didn't respond. If you
haven't you could well save yourself a lot of time but just checking. It is
the most likely cause of your problem.


Jan 19 '07 #7
Anthony,

I am sorry, I didn't read the answer carefully, I thought you were
suggesting the same thing. Actually you may be pointing out to the core
of the problem. I thought these kind of encodings were done
automatically by the email sender component, however I just checked the
reference for it and it says I have to set ContentTransferEncoding
property to "quoted-printable" to have quoted-printable. So I will
definitely try that.

Thanks for the followup!!!

Deniz
Anthony Jones wrote:
>
Have you yet confirmed whether the HTML body part is being encoded as
quoted-printable. I said this already but you didn't respond. If you
haven't you could well save yourself a lot of time but just checking. It is
the most likely cause of your problem.
Jan 23 '07 #8

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

Similar topics

4
by: higabe | last post by:
Three questions 1) I have a string function that works perfectly but according to W3C.org web site is syntactically flawed because it contains the characters </ in sequence. So how am I...
5
by: Les Juby | last post by:
A client needs a routine to alert him as to which memo records in an Access-2000 database have had double apostrophes inserted in the text. These are stopping a Java mouseover from executing. ...
5
by: nboutelier | last post by:
Scenario: you enter "foo bar" into a text field... Is it possible through javascript to select/highlight just "foo"? formObject.select() selects all. I need to select only part of the string....
13
by: dimitris67 | last post by:
How can I replace an occurence of p(a string) in an other string(s) with np(new string).. char* replace _pattern(char *s,char *p,char *np) PLEASE HELP ME!!!!!
19
by: Paul | last post by:
hi, there, for example, char *mystr="##this is##a examp#le"; I want to replace all the "##" in mystr with "****". How can I do this? I checked all the string functions in C, but did not...
12
by: Jeff S | last post by:
In a VB.NET code behind module, I build a string for a link that points to a JavaScript function. The two lines of code below show what is relevant. PopupLink = "javascript:PopUpWindow(" &...
5
by: djc | last post by:
I need to prepare a large text database field to display in an asp.net repeater control. Currently I am replacing all chr(13)'s with a "<br/>" and it works fine. However, now I also want to be able...
16
by: ^MisterJingo^ | last post by:
Hi all, I have a variable called root which contains (E:\Web\Websites\fileBrowse\) and then I have a variable called path which uses root, and adds directories on to it (this is part of a file...
10
by: TC | last post by:
Hey All, I have strings in currency. For example: "$1.29" What is the best way to convert them to decimal formatted like: "1.29" Thanks, TC
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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,...
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
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,...
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...

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.