plus sign not recognized RRS feed

  • General discussion

  • Using Instant answers (with json response) the "+" is not recognized in the query.


    returns an entry about Feb, 2

    2 plus 2

    returns 4

    returns 1 (although 2/2 could be a date)

    Friday, January 16, 2009 11:24 PM

All replies

  • Within the query string, the plus sign is specifically reserved as shorthand notation for a space.  Therefore, real plus signs must be URL encoded. Please use 2%2B2 as your query string.




    Saturday, January 17, 2009 12:54 AM
  • Are there any other symbols that need to be escaped?
    Or is there a list anywhere?
    I am taking the input directly from a html text input box.

    I would guess then that formulas on Instant Answers are useless without escaping.
    I thought I had tried this earlier and it had worked correctly (and of course in live search it works ok).

    I used:

    escape() method - same results (error)

    encodeURI() method - same results (error)

    encodeURIComponent() method - WORKS as intended

    Do you know if this method create any unexpected results?

    Saturday, January 17, 2009 1:57 AM
  • No. encodeURIComponent is the only one that should work in this context. It is desiged for this purpose exactly.





    Monday, January 19, 2009 4:35 PM