PDA

View Full Version : Escaping Carriage Return


arielex
01-08-2003, 04:48 PM
Hi

Is there any way to escape a carriage return in asp?

I have textfields which go into a mssql database as CHAR. Another script uses this code in javascript, the kind that works without the ";" at the end of the line but with enter... Now i need to clear those enters or the javascript will generate an error

i like to use something similar to this (this one is for the quotes)
string2 = Replace(string1, "'", "\\'")

I tried this but no good (also chr(9 - 12))
string3 = Replace(string2, chr(13), "")

This some generated javascript, you see the last quote is on the next line..... aaargh
myArray1[2] = 'ghjgj' //good
myArray2[2] = 'jhgjhgjgj' //good
myArray3[2] = 'gjgjgjgj //error
'

Please help me, i need to present this program to a customer tomorrow...... :(

Arie

arnyinc
01-08-2003, 06:21 PM
I'm almost certain you need to replace a vbcrlf (visual basic carriage return line feed).

string3 = Replace(string2, vbcrlf, "")

arielex
01-09-2003, 12:09 PM
Thanks, that worked, i'm saved