couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <>
Subject Re: Invalid json in view param error...
Date Thu, 12 Mar 2009 17:08:06 GMT
On Tue, Mar 10, 2009 at 01:55:01PM -0700, Rob Law wrote:
> Hi,
> I have a graph that tries to access a list like this:
> http://localhost:5984/email_events/_list/events/pie/count_with_lead_by_home_price?startkey=["2005/06/25"]&endkey=["2008/06/29
> Z"]
> and it works as expected.  The problem is I get a JSON error if I replace
> the & with it's equivalent %26 like so:
> http://localhost:5984/email_events/_list/events/pie/count_with_lead_by_home_price?startkey=["2005/06/25"]%26endkey=["2008/06/29
> Z"]

No, they are not equivalent.

>From RFC 3986:

  "The purpose of reserved characters is to provide a set of delimiting
   characters that are distinguishable from other data within a URI.
   URIs that differ in the replacement of a reserved character with its
   corresponding percent-encoded octet are not equivalent.  Percent-
   encoding a reserved character, or decoding a percent-encoded octet
   that corresponds to a reserved character, will change how the URI is
   interpreted by most applications." 

& is one of those reserved characters.

If this were not the case, it would be impossible to use a query parameter
whose value contained the character '&'

For example:
   ....?foo=bar&baz=bap        -- has two params (foo and baz)
   ....?foo=bar%26baz%3dbap    -- has one param (foo)



View raw message