Hi,
These past few weeks, I've been re-building our flagship product as a Flex application, with couchdb as the back end, and this has been progressing really well. However, I've hit a strange snag, to do with URL encoding. Flex's HTTPService component automatically url-encodes requests, so that...

....?startkey=["SYD","LAX","2008-01-01T00:00:00Z"]&endkey=["SYD","LAX",2008-01-01T23:59:59Z"]

becomes...

....?startkey=[%22SYD%22,%22LAX%22,%222008-01-01T00:00:00Z%22]&endkey=[%22SYD%22,%22LAX%22,....etc....]

that is, when I look at the Erlang console after the request has been sent from Flex, I see the request with quotes encoded as %22's as shown above when issued from Flex.

The trouble is, couchdb fails to return any rows when those quotes are encoded as %22's like that. When I issue the exact same request in curl, the quotes are not automatically encoded (they still show as quotes in Erlang's console), and I get the correct result set for the view. I always use group=true, so that's not the difference.

What is particularly strange to me, is that a different design/view I have works perfectly with the following key:

....?startkey=[911,%222008-01-01T00:00:00Z%22]&...etc

In this case, the first item in the key is an unquoted integer, but couchdb is still fine with the quoted date, and correctly returns a result from either Flex or curl.

Any suggestions from a kind soul out there?

Cheers,
Kai

Reply via email to