How to quote quotes in vbscript?

Results 1 to 5 of 5

Thread: How to quote quotes in vbscript?

  1. #1
    snowed-in Guest

    Default How to quote quotes in vbscript?

    I have a string that I need to build in an ASP page and use for an XML <BR>request. I have a string that works beautifully in jscript, but <BR>because of some interfacing issues, I need to re-write it in vbscript. <BR>The problem is that it&#039;s a string that contains several quotes that <BR>need to be interpreted as text, and a few quotes that need to be <BR>interpreted so that it just gets the value of the local variable. <BR>Here&#039;s the working jscript code:<BR><BR>-------------- this is one line...<BR>&#039;&#060;serializedstream <BR>xmlns="http://222.333.444.55/Schemas/DisplayRequestSchema.xml" <BR>xmlns:header="http://222.333.444.55/Schemas/HeaderSchema.xml"&#062;&#060;header:he<BR>ader port="xxxx" userid="yyyy" password="1234abc" esid="&#039; & myVar1 & &#039;" <BR>item6="&#039; & myVar2 & &#039;"/&#062;&#060;display systemnumber="&#039; & myVar3 & <BR>&#039;"&#062;&#060;customeroptions customernamedata="1" specialrequestsdata="0" <BR>specialnotesdata="0" remarksdata="0" /&#062;&#060;/display&#062;&#060;/serializedstream&#062;&#039;<BR>---------------<BR><BR>Does anyone know how the quotes need to be changed so that the current <BR>double quotes are interpreted as text, and I still get the values of <BR>myVar with text quotes around them in there? Any help is appreciated!<BR><BR>Thanks!

  2. #2
    Lance Watanabe Guest

    Default RE: How to quote quotes in vbscript?

    I&#039;m not sure if this is EXACTLY what you&#039;re looking for since I&#039;m not familiar with XML, yet, but it sounds like the problem I have outputting a string, with quotes in it, to the response object.<BR><BR>For example, if you want to output this --&#062; He said, "Hello!" you would have to write your vb code like this:<BR><BR> Response.write("He said, ""Hello!"" ") <BR><BR>In essence you would replace each quotation mark (") that you want to output with "".<BR><BR>

  3. #3
    Varadaraj Venu Madhav Guest

    Default RE: How to quote quotes in vbscript?

    I am not aware of XML that much but U can add quotes in VBscript simply like this<BR><BR>Response.write Chr(34) &"This text displays with double quotes" & chr(34)<BR><BR>the output will be "This text displays with double quotes"<BR>hope this will do.<BR>If not pl. mail me at<BR><BR>all the best<BR>

  4. #4
    Join Date
    Dec 1969

    Default RE: How to quote quotes in vbscript?

    for xml you should replace the the " with &quot;<BR><BR>replace other special characters like this:<BR>& = &amp;<BR>&#060; = &lt;<BR>&#062; = &gt;<BR>" = &quot;<BR>&#039; = & apos;<BR>

  5. #5
    Lynn Popwell Guest

    Default RE: How to quote quotes in vbscript?

    I got around my inability to count double quotes by using ~ as a place holder for double quotes in the output string. Then used this routine to generate the actual output.<BR><BR>&#039; Send XML string to the client<BR>Sub SendXML( sStringXML )<BR>sStringXML = Replace( sStringXML, "~", """""" )<BR>Response.Write( sStringXML )<BR>END SUB<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts