Sanic: Error: Overlong 2 byte UTF-8 sequence detected when encoding string

Created on 22 Oct 2016  路  3Comments  路  Source: sanic-org/sanic

while return json(doc), doc is fetched from mongodb.

Most helpful comment

Finally I found out that this was caused by the problem of json(mongodb.ObjectID), mongodb.ObjectID cannot be serialized by the json method.

All 3 comments

Hmm, it's possible the encoding of the contents of doc are not utf-8. Do you have some example code I could see?

Finally I found out that this was caused by the problem of json(mongodb.ObjectID), mongodb.ObjectID cannot be serialized by the json method.

@rainyear in pandas the same problem and the same solution. just remove _id and everything fine.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

1067511899 picture 1067511899  路  3Comments

geekpy picture geekpy  路  4Comments

mobdim picture mobdim  路  4Comments

ZeeRoc picture ZeeRoc  路  3Comments

litelife picture litelife  路  3Comments