简体   繁体   English

peewee + mysql,如何确保表情符号被正确存储和检索(得到?的)

[英]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.我将表情符号存储在 MYSQL8 的 varchar 列中,字符集 utf8mb4 编码为 utf8mb4_unicode_ci 我正在使用 peewee 获取值,而我正在获取?

What may I be doing wrong?我可能做错了什么? What else do I have to do to make sure emojis come through intact?我还需要做些什么来确保表情符号完好无损?

You might try setting charset='utf8mb4 in your db constructor:您可以尝试在数据库构造函数中设置charset='utf8mb4

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM