I am using Python 2.7.9 with coucbhase 3
This is my code to insert to couchbase using Python SDK
from couchbase import Couchbase
connection = Couchbase.connect(bucket='default') #create connection to the couchbase database
connection.set(fileName, dict(item)) #write the item to the couchbase database
Where fileName is a unique ID and item is an instance of class like this:
flexibleItem = FlexibleItem()
flexibleItem['location'] = "UAE \u202a>\u202a Dubai \u202a>\u202a The Palm Jumeirah ; 3.4 km from Dubai Media City \u00a0"
I got this exception:
couchbase.exceptions.ValueFormatError: <Couldn't encode value, inner_cause='ascii' codec can't decode byte 0xe2 in position 5: ordinal not in range(128),
though i already change the value to utf8 using this code:
value = value.encode(‘utf-8’, ‘ignore’)