Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parse double quotes in variable string

Status
Not open for further replies.

spastica

Programmer
Sep 27, 2002
72
GB
i am getting info from a form, and then setting the form field values into session variables using request.form to get the form values. these variables are then passed on and emailed to a user.

the problem is, some of the form field values have double quotes (eg. "one") and these are causing problems. I wrote a function that replaces all double quotes with ", which works fine on html pages, but does not show up as quotes in the plain text email that sends out the values.

is there a way to do this so that it works in both the html pages as well as the plain text email?
 
replace(formdata,""","""") should do the trick
 
that doesn't work...i'm getting an error that says

Unterminated string constant

/includes/vars/pageOneVars.asp, line 8

ParseQuotes = Replace(strToRenderSafe,""","""")
-----------------------------------------------^


 
ParseQuotes = Replace(strToRenderSafe,"""","DOUBLEQOUTE")


Known is handfull, Unknown is worldfull
 
Sorry. Use:

ParseQuotes = Replace(strToRenderSafe,"""","""""")

 
If your already replacing with the " why not simply replace all of the "s with "'s before assigning the text to the email body?

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
I, too have had problems with double and single quotes. What I did, was replace the " with `
That way, I can use " to surround my strings and ' to surround strings inside the strings. e.g.:

response.write ( "<script language=""javaScript"">window.location='newpage.asp?parm=" & strSomeString & "';</script>" )

Now, let's say that strSomeString has ' or " characters inside it. That would surely ruin your call. By replacing " and ' with ` you get around the problem. Nobody will ever notice that there is a ` instead of a '.

Try it.
Jerry


Jerry Scannell
JerryScannell@cox.net or
JScannell@citystatecomputer.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top