TDB = csv.reader(codecs.open('data/TDS.csv', 'rb', encoding='utf-8'), delimiter=',', quotechar='"')
ts = db.testCol
for row in TDB:
print row[1]
T = {"t":row[1],
"s": row[0]}
post_id = ts.insert(T)
I not sure why i can't encode it into utf-8 while i want to insert data into database i must make it in utf8 format.
UnicodeDecodeError: 'utf8' codec can't decode byte 0xf3 in position 36: invalid continuation byte
Before i put the encoding function, i got this from pymongo.
bson.errors.InvalidStringData: strings in documents must be valid UTF-8
and i guess, this is the data it couldn't encode
'compleja e intelectualmente retadora , el ladrÛn de orquÌdeas es uno de esos filmes que vale la pena ver precisamente por su originalidad . '
Anyone know how should i do? Thanks
open()(not codecs.open()), and not worry about the conversion.