incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From He Shiming <heshim...@gmail.com>
Subject 400, ('bad_request', 'Attachment name is not UTF-8 encoded')
Date Thu, 03 Feb 2011 12:59:05 GMT
Hi,

I'm accessing CouchDB 1.0.1 on localhost from python-couchdb. I
discovered this problem while trying to use Chinese characters to name
attachments of the document.

So I'm calling couchdb.Database.put_attachment with some Chinese
characters as name: u'\u7eff\u53f6\u60c5-2753303'. Attachment saving
will cause an HTTP 400 error, with message 'Attachment name is not
UTF-8 encoded'.

I'm not sure if I should encode the string to utf-8 myself. So I tried
to encode the above string by unicode(filename).encode('utf-8'). It
becomes: '\xe7\xbb\xbf\xe5\x8f\xb6\xe6\x83\x85-2753303'. I still got
the same error.

Sometimes it's not even HTTP 400 error. It's "error: [Errno 104]
Connection reset by peer", which means the connection got cut off
unexpectedly. But other functions of CouchDB remain fine after this
error. It's happening to non-alphanumeric character attachment names
in particular.

Is this a bug or should I avoid using such names as attachment name?

-- 
Best regards,
He Shiming

Mime
View raw message