encoding was done twice, once while setting attachment
and once while saving the document.
Also the attachment was decoded while retreaving, but this is done by
CouchDB itself automatically, as described in
http://wiki.apache.org/couchdb/HTTP_Document_API#line-463.
Signed-off-by: Marcos Tapajós <tapajos@gmail.com>