Aaron said:
I've never had a problem using Replace(), but I use chr(10)
or vbCrLf, not chr(13). I also only doing this when
*displaying* the data, not when storing it. I'm not sure why
you think "the embedded return is lost" because it is not.
Could you show some sample code that reproduces this problem?
Since the OP did not elaborate, I would like to offer this observation:
*Leading* carriage returns are not rendered by some browsers[1], meaning
they must be accounted for in post-back situations.
In other words, if you have something like this...
<textarea name="txt"><%=Request.Form("txt").Item%></textarea>
....and type the equivalent of "\r\nTest\r\n" (or: vbCrLf & "Test" & vbCrLf),
then the resulting HTML source is...
<textarea name="txt">
Test
</textarea>
....which is rendered in the browser identically to this:
<textarea name="txt">Test
</textarea>
Note that the carriage return was not lost in the form submission, as the
resultant HTML source properly contains it. Furthermore, the *trailing*
carriage returns are retained. It is an oddity, but not the only one.
Displaying the text outside the form control is a whole other animal.
Consider what happens when the following are added to my example:
<style type="text/css">
div { border:solid 1px #ccc; white-space

re; }
pre { border:solid 1px #ccc; }
</style>
<div><%=Server.HTMLEncode(Request.Form("txt").Item)%></div>
<pre><%=Server.HTMLEncode(Request.Form("txt").Item)%></pre>
<div><%=Request.Form("txt").Item%></div>
<pre><%=Request.Form("txt").Item%></pre>
In all tested browsers, neither leading nor trailing carriage returns are
rendered <pre> in here </pre>. IE treats <div style="white-space

re;">
identically. Opera and Firefox retain the leading carriage returns, but lost
the trailing ones. In all three browsers, the "white-space

re" rendering
conflicts with that of <textarea>. It's no wonder the OP might think his
carriage returns are being lost.
[1] IE and Firefox, at a minimum. Opera does not lose them. UAs tested:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; en) Opera 8.01
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.7.10) Gecko/20050716
Firefox/1.0.6
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322;
..NET CLR 1.0.3705; .NET CLR 2.0.40607)
--
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. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.