配置Typecho支持emoji
9102年,说话带几句emoji再平常不过了,然鹅Typecho默认并不支持emoji,写好的文章中的emoji无法显示,很没排面。所以这次给Typecho安排一个emoji
运行sql语句修改数据库编码
alter table typecho_comments convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_contents convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_fields convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_metas convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_options convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_relationships convert to character set utf8mb4 collate utf8mb4_general_ci;
alter table typecho_users convert to character set utf8mb4 collate utf8mb4_general_ci;
更改数据库配置文件config.inc.php
/** 定义数据库参数 */
$db = new Typecho_Db('Pdo_Mysql', 'typecho_');
$db->addServer(array (
...
'charset' => 'utf8mb4', // 此处修改编码为 utf8mb4
...
), Typecho_Db::READ | Typecho_Db::WRITE);
Typecho_Db::set($db);
搞定!
但是很失望的是只能直接插入emoji,不支持通过markdown语法插入。
:bear:
🐻