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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft.XMLHTTP Strips Spaces from Parameters?

Status
Not open for further replies.

baden

Programmer
Feb 6, 2002
125
US
Given the following code:
Code:
        Dim objXmlHttp2
        Set objXmlHttp2 = Server.CreateObject("Microsoft.XMLHTTP")

         smsSend = "[URL unfurl="true"]http://"[/URL] & Request.ServerVariables("SERVER_NAME") & "/myfile.asp?"          

         params2Send = "p1=Some text with spaces to send" & Session("userID") & _
                       "&p2=More text with spaces and it's own quotes" &

         objXmlHttp2.open "POST", smsSend, False
         objXmlHttp2.SetRequestHeader "Content-type", "application/x-[URL unfurl="true"]www-form-urlencoded"[/URL]  ' sending via Form
             
         ' Send it on it's merry way.
         objXmlHttp2.send params2Send
 
 . . .

In myFile.asp, doing a Request.Form("p1") shows that all spaces have been stripped from the text. (is this normal?)
So I created used Replace() to insert special char's to signify spaces. But if the text contains single/double quotations, it truncates at that point.
ie, using
Code:
   2nd last OK... "Need" in "About/Education"

I replaced spaces with |_| but the resulting text on the receiving page is
Code:
   2nd|_|last|_|OK...|_|

That's it.... truncated at the quotation mark.

Does the prob. have something to do with "Content-type", "application/x- ?

Any help on this?
 
Used Server.URLEncode("the text . .. ") to fix the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top