incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "william kinney" <william.kin...@gmail.com>
Subject Re: startkey and quotes
Date Thu, 18 Sep 2008 16:09:15 GMT
URLEncoder to the rescue. I could have sworn I saw it failed on testing w/ a
hard coded %22. Much thanks!
Will

On Thu, Sep 18, 2008 at 11:50 AM, Christopher Lenz <cmlenz@gmx.de> wrote:

> Hey Will,
>
> On 18.09.2008, at 17:29, william kinney wrote:
>
>> It seems that the startkey query parameter requires quotes around the
>> value.
>> However, my lovely Apache java HttpClient library doesn't like that, and
>> throws a org.apache.commons.httpclient.URIException: Invalid query.
>> Has anyone had any experience with this? I'd like to avoid having to
>> extend
>> or hack http client to get around this.
>>
>
> You should percent-encode the quotes before passing them to HttpClient.
>
> In this case, " -> %22
>
> See <http://en.wikipedia.org/wiki/Percent-encoding>
>
>  On a side note, I've never seen quotes being specified/used in query
>> parameters before. I couldn't find any mention of it in the w3c spec. I'm
>> sure of course it is intended functionality. Bu t does anyone know why?
>>
>
> The key parameters need to be JSON encoded values, as they can be some
> other type than strings, such as integers, arrays or dictionaries. So the
> rule is: JSON-encode the value (which will need to be either ASCII or
> UTF-8), then percent-encode, finally pass the complete URI to the HTTP
> client lib.
>
> Cheers,
> --
> Christopher Lenz
>  cmlenz at gmx.de
>  http://www.cmlenz.net/
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message