Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 235 by
hhmw56...@gmail.com: Doc write exception with unicode
characters
http://code.google.com/p/couchdb-python/issues/detail?id=235
What steps will reproduce the problem?
The following test script fails with 0.9, but works fine with 0.8:
import json
import couchdb
db = couchdb.Server(u"https://<username>:<password>@<server>")['<database>']
docs = [{u'Type':"TestDoc", u'Test':True, u'val':unichr(40960)}]
ret = db.update( docs )
print ret
What is the expected output? What do you see instead?
The write should succeed.
The exception is:
File "couch_encoding_test.py", line 10, in <module>
ret = db.update( docs )
File "/usr/local/lib/python2.7/dist-packages/CouchDB-0.9-py2.7.egg/couchdb/client.py",
line 764, in update
_, _, data = self.resource.post_json('_bulk_docs', body=content)
File "/usr/local/lib/python2.7/dist-packages/CouchDB-0.9-py2.7.egg/couchdb/http.py",
line 527, in post_json
**params)
File "/usr/local/lib/python2.7/dist-packages/CouchDB-0.9-py2.7.egg/couchdb/http.py",
line 546, in _request_json
headers=headers, **params)
File "/usr/local/lib/python2.7/dist-packages/CouchDB-0.9-py2.7.egg/couchdb/http.py",
line 542, in _request
credentials=self.credentials)
File "/usr/local/lib/python2.7/dist-packages/CouchDB-0.9-py2.7.egg/couchdb/http.py",
line 327, in request
resp = _try_request_with_retries(iter(self.retry_delays))
File "/usr/local/lib/python2.7/dist-packages/CouchDB-0.9-py2.7.egg/couchdb/http.py",
line 285, in _try_request_with_retries
return _try_request()
File "/usr/local/lib/python2.7/dist-packages/CouchDB-0.9-py2.7.egg/couchdb/http.py",
line 307, in _try_request
conn.endheaders(body)
File "/usr/lib/python2.7/httplib.py", line 954, in endheaders
self._send_output(message_body)
File "/usr/lib/python2.7/httplib.py", line 812, in _send_output
msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0xea in position 52:
ordinal not in range(128)
What version of the product are you using? On what operating system?
couchdb-python 0.9, ubuntu 12.04
Please provide any additional information below.
If the parameter to couchdb.Server is a str instead of a unicode object,
the script executes correctly.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings