Search code examples
pythonmysqlpeewee

peewee + mysql, how to make sure emoji are properly stored and retrieved (getting ?'s)


I have emoji stored in varchar column in MYSQL8, with charset utf8mb4 encoding utf8mb4_unicode_ci I am getting the value with peewee and I'm getting ?'s instead.

What may I be doing wrong? What else do I have to do to make sure emojis come through intact?


Solution

  • You might try setting charset='utf8mb4 in your db constructor:

    MySQLDatabase(..., charset='utf8mb4')