Enabling Emoji Support in Typecho

Machine-translated (anthropic, claude-haiku-5-5) from the Chinese original. Read the original in 中文

Contents

Foreword

Hehe, I have no articles to write lately, so I can only fill space!

Main Text

First, let's change the database encoding.

1. Change the Database Encoding

Open PhpMyAdmin. In the settings of the database that holds the blog data (Operations - Collation), select utf8mb4_unicode_ci.

2. Change the Database Table Encoding

Execute the following SQL statements:

sql
alter table typecho_comments convert to character set utf8mb4 collate utf8mb4_unicode_ci; 
alter table typecho_contents convert to character set utf8mb4 collate utf8mb4_unicode_ci; 
alter table typecho_fields convert to character set utf8mb4 collate utf8mb4_unicode_ci; 
alter table typecho_metas convert to character set utf8mb4 collate utf8mb4_unicode_ci; 
alter table typecho_options convert to character set utf8mb4 collate utf8mb4_unicode_ci; 
alter table typecho_relationships convert to character set utf8mb4 collate
utf8mb4_unicode_ci; 
alter table typecho_users convert to character set utf8mb4 collate utf8mb4_unicode_ci;

Change typecho in the table names to your own database table prefix.

3. Modify the Database Configuration File

In the database configuration file (config.inc.php) in the website root directory, change 'charset' => 'utf8', in about line five to utf8 and change it to utf8mb4.

sql
$db->addServer(array ( 
'host' => localhost, 
'user' => 'youruser', 
'password' => 'yourpassword', 
'charset' => 'utf8mb4', //修改这一行
'port' => 3306,
'database' => 'yourdatabase' ), Typecho_Db::READ | Typecho_Db::WRITE);

Then you can go wild!

Comments