couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Lenz <cml...@gmx.de>
Subject Re: startkey and quotes
Date Thu, 18 Sep 2008 15:50:26 GMT
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
View raw message