1 Reply Latest reply on Oct 18, 2006 7:47 PM by CutterBl

    form post encoding characters goofy

    Level 7
      im tring to post a bit of xml text as a form variable. when i do so, it
      is received but characters such as <space> < and ? get converted
      goofy..... anyway here is some of the code, which should help.

      i must do it this way, as it is spec for the parter we are working with....



      <!---- RECEIVE CODE ------->
      <cfset thehttpdata = GetHttpRequestData()>
      <cfoutput>
      <cfif LEN(thehttpdata.content) GT 0>
      <cfset variables.XML = thehttpdata.content>
      <h3>Raw Result:</h3>#variables.XML#
      <cftry>
      <cfset xmlobject = xmlparse(#variables.XML#)>
      <cfdump var="#xmlobject#" expand="yes">
      <cfscript>
      status = XmlSearch(xmlobject, "/decision/status");
      date = XmlSearch(xmlobject, "/decision/date");
      applied_date = XmlSearch(xmlobject, "/decision/applied_date");
      firstname = XmlSearch(xmlobject, "/decision/firstname");
      lastname = XmlSearch(xmlobject, "/decision/lastname");
      loanamount = XmlSearch(xmlobject, "/decision/loanamount");
      rate = XmlSearch(xmlobject, "/decision/rate");
      partner_loannumber = XmlSearch(xmlobject, "/decision/
      partner_loannumber");
      loannumber = XmlSearch(xmlobject, "/decision/loannumber");
      </cfscript>
      <cfquery name="qryUpdateAStatus" datasource="#dsn#">
      INSERT INTO tblStatus
      (status,date,applied_date,firstname,lastname,loanamount,rate,partner_loannumber,
      loannumber) VALUES ('#status[1]#', '#date[1]#', '#applied_date[1]#',
      '#firstname[1]#', '#lastname[1]#','#loanamount[1]#', '#rate[1]#',
      '#partner_loannumber[1]#','#loannumber[1]#')
      </cfquery>

      <cfcatch>
      Returned result not parsed correctly. Status NOT recorded in database.
      </cfcatch>
      </cftry>
      <cfelse>
      No data received<br />
      </cfif>
      </cfoutput>






      <!--- my send test page, not sure whats the problem here...... --->

      <cfparam name="form.destserver" default="thereceivefilename.cfm"

      <cfform name="xmlpush" action="#form.destserver#" method="post" >
      <h4> This form will send text below to
      <cfoutput>#form.destserver#</cfoutput>

      <input value="go" type="submit" width="30" name="submit" /></h4>
      <textarea name="xmlData" cols="80" rows="20"><cfoutput></cfoutput></
      textarea><br />
      </cfform>






      i open the send page, and paste in sample xml:

      <?xml version="1.0" standalone="yes" ?><decision><status>status</
      status><date>date</date><applied_date>applied_date</
      applied_date><firstname>firstname</firstname><lastname>lastname</
      lastname><loanamount>13231</loanamount><rate>12</rate><partner_loannumber>
      partner_loannumber</partner_loannumber><loannumber>loannumber</
      loannumber></decision>





      and the received text looks like this:

      submit=go&xmlData=%3C%3Fxml+version%3D%221.0%22+standalone%3D%22yes%22+%
      3F%3E%3Cdecision%3E%3Cstatus%3Estatus%3C%2Fstatus%3E%3Cdate%3Edate%3C%2Fdate%
      3E%3Capplied_date%3Eapplied_date%3C%2Fapplied_date%3E%3Cfirstname%3Efirstname%
      3C%2Ffirstname%3E%3Clastname%3Elastname%3C%2Flastname%3E%3Cloanamount%
      3E13231%3C%2Floanamount%3E%3Crate%3E12%3C%2Frate%3E%3Cpartner_loannumber%3E
      +partner_loannumber%3C%2Fpartner_loannumber%3E%3Cloannumber%3Eloannumber%3C
      %2Floannumber%3E%3C%2Fdecision%3E



      any suggestions would be appreciated. not sure if my sending or
      receiving is wrong, or if i need to find/replace the received text (yuck).

      thanks,
      andrew