摘要:记录一下typecho保存文章时,可能由于字符不兼容报错 Database Query Error

    typecho太古老了,采用的还是utf8字符串。如果文章采用了特殊的表情符号的时候,保存文章会报错。

    "PHP message: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x9A\x80 \xE5...' for column 'text' at row 1"

    这里记录一下解决办法:

    第一步:

    typecho所用数据库的字符集和排序规则分别设置成utf8utf8mb4_general_ci,如下:

    typecho保存文章1.png

    第二步:
    typecho_comments表的text字段的字符集和排序规则分别设置成utf8utf8mb4_general_ci
    typecho保存文章2.png

    typecho_contents表的text字段的字符集和排序规则分别设置成utf8utf8mb4_general_ci

    typecho保存文章3.png

    第三步:

    修改 /www/config.inc.php 文件,将charset修改成utf8mb4
    typecho保存文章4.png