dataabc / weiboSpider

新浪微博爬虫,用python爬取新浪微博数据
8.46k stars 1.98k forks source link

运行·获取的微博内容出现特殊字符不能写入·mysql数据库 #535

Open shuangxi2006 opened 1 year ago

shuangxi2006 commented 1 year ago

为了更好的解决问题,请认真回答下面的问题。等到问题解决,请及时关闭本issue。

答:pypi版本 0.0.2

答:是

答:是

答:

答:

答:pymysql.err.DataError: (1366, "Incorrect string value: '\xF0\x9F\x8E\xA5F1...' for column weibo.weibo.content at row 1")

dataabc commented 1 year ago

感谢反馈。您把数据库编码改成utf8mb4看看。

shuangxi2006 commented 1 year ago

是的现在的编码已经是:utf8mb4_unicode_ci,服务器默认是:utf8mb4_general_ci

shuangxi2006 commented 1 year ago

I confirmed the database, table, column character set were all utf8mb4.

The problem was solved by changing the field type to longtext.

Hope this could help someone.

stale[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.