Loading ...
Sorry, an error occurred while loading the content.

Re: Does asyncrequest strip certain characters?

Expand Messages
  • randomjuju
    In URL encoding, a plus sign translates into a space. For example, if you were to search Yahoo for user interface library , you d see that you were
    Message 1 of 4 , Jan 2, 2007
    • 0 Attachment
      In URL encoding, a plus sign translates into a space. For example, if
      you were to search Yahoo for "user interface library", you'd see that
      you were redirected to the following URL:

      http://search.yahoo.com/search?p=user+interface+library...

      To escape the plus signs, you might take whatever data you're sending
      and call its 'replace' method (assuming it's a string). For example:

      '2 + 2 = 5'.replace(/\+/, '%2B');

      Does that help?

      -Jon

      --- In ydn-javascript@yahoogroups.com, "carltondickson"
      <carltondickson@...> wrote:
      >
      > I am trying to figure out why a simple post request appears to be
      > stripping '+' (plus) symbols from my postdata...I opened up
      > connection.js, located the asyncRequest function and printed out a
      > firebug console command to try to better understand where the postdata
      > was being changed
      >
      > <code>
      > asyncRequest:function(method, uri, callback, postData)
      > {
      > console.info(postData);
      > .
      > .
      > .
      >
      > }
      > </code>
      >
      > The output was what I expected...
      >
      > method=saveForm&vFormName=+44&vFormDescription=+44
      >
      > but when I edit the PHP service to display phpinfo I get this, which
      > suggests somewhere along the line the + has been removed, and I'm not
      > too sure where??
      >
      > Variable Value
      > _REQUEST["method"] saveForm
      > _REQUEST["vFormName"] 44
      > _REQUEST["vFormDescription"] 44
      >
      > Do you think this is an AJAX issue or something to do with Apache?
      >
    • carltondickson
      Thanks Jon, that totally makes sense...I ended up using the following to replace all occurences of + , thanks for the solution 2 + 2 = 5 .replace(/ +/g,
      Message 2 of 4 , Jan 3, 2007
      • 0 Attachment
        Thanks Jon, that totally makes sense...I ended up using the following
        to replace all occurences of '+', thanks for the solution

        '2 + 2 = 5'.replace(/\+/g, '%2B');



        --- In ydn-javascript@yahoogroups.com, "randomjuju" <jon.chambers@...>
        wrote:
        >
        > In URL encoding, a plus sign translates into a space. For example, if
        > you were to search Yahoo for "user interface library", you'd see that
        > you were redirected to the following URL:
        >
        > http://search.yahoo.com/search?p=user+interface+library...
        >
        > To escape the plus signs, you might take whatever data you're sending
        > and call its 'replace' method (assuming it's a string). For example:
        >
        > '2 + 2 = 5'.replace(/\+/, '%2B');
        >
        > Does that help?
        >
        > -Jon
        >
        > --- In ydn-javascript@yahoogroups.com, "carltondickson"
        > <carltondickson@> wrote:
        > >
        > > I am trying to figure out why a simple post request appears to be
        > > stripping '+' (plus) symbols from my postdata...I opened up
        > > connection.js, located the asyncRequest function and printed out a
        > > firebug console command to try to better understand where the postdata
        > > was being changed
        > >
        > > <code>
        > > asyncRequest:function(method, uri, callback, postData)
        > > {
        > > console.info(postData);
        > > .
        > > .
        > > .
        > >
        > > }
        > > </code>
        > >
        > > The output was what I expected...
        > >
        > > method=saveForm&vFormName=+44&vFormDescription=+44
        > >
        > > but when I edit the PHP service to display phpinfo I get this, which
        > > suggests somewhere along the line the + has been removed, and I'm not
        > > too sure where??
        > >
        > > Variable Value
        > > _REQUEST["method"] saveForm
        > > _REQUEST["vFormName"] 44
        > > _REQUEST["vFormDescription"] 44
        > >
        > > Do you think this is an AJAX issue or something to do with Apache?
        > >
        >
      • randomjuju
        Ah -- whoops. Knew I forgot something ;) Glad it helped -- rock on! -Jon ... postdata ... I m not
        Message 3 of 4 , Jan 3, 2007
        • 0 Attachment
          Ah -- whoops. Knew I forgot something ;)

          Glad it helped -- rock on!

          -Jon

          --- In ydn-javascript@yahoogroups.com, "carltondickson"
          <carltondickson@...> wrote:
          >
          > Thanks Jon, that totally makes sense...I ended up using the following
          > to replace all occurences of '+', thanks for the solution
          >
          > '2 + 2 = 5'.replace(/\+/g, '%2B');
          >
          >
          >
          > --- In ydn-javascript@yahoogroups.com, "randomjuju" <jon.chambers@>
          > wrote:
          > >
          > > In URL encoding, a plus sign translates into a space. For example, if
          > > you were to search Yahoo for "user interface library", you'd see that
          > > you were redirected to the following URL:
          > >
          > > http://search.yahoo.com/search?p=user+interface+library...
          > >
          > > To escape the plus signs, you might take whatever data you're sending
          > > and call its 'replace' method (assuming it's a string). For example:
          > >
          > > '2 + 2 = 5'.replace(/\+/, '%2B');
          > >
          > > Does that help?
          > >
          > > -Jon
          > >
          > > --- In ydn-javascript@yahoogroups.com, "carltondickson"
          > > <carltondickson@> wrote:
          > > >
          > > > I am trying to figure out why a simple post request appears to be
          > > > stripping '+' (plus) symbols from my postdata...I opened up
          > > > connection.js, located the asyncRequest function and printed out a
          > > > firebug console command to try to better understand where the
          postdata
          > > > was being changed
          > > >
          > > > <code>
          > > > asyncRequest:function(method, uri, callback, postData)
          > > > {
          > > > console.info(postData);
          > > > .
          > > > .
          > > > .
          > > >
          > > > }
          > > > </code>
          > > >
          > > > The output was what I expected...
          > > >
          > > > method=saveForm&vFormName=+44&vFormDescription=+44
          > > >
          > > > but when I edit the PHP service to display phpinfo I get this, which
          > > > suggests somewhere along the line the + has been removed, and
          I'm not
          > > > too sure where??
          > > >
          > > > Variable Value
          > > > _REQUEST["method"] saveForm
          > > > _REQUEST["vFormName"] 44
          > > > _REQUEST["vFormDescription"] 44
          > > >
          > > > Do you think this is an AJAX issue or something to do with Apache?
          > > >
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.