当前位置:网站首页>How to handle the database query error with Emoji expression in Typecho- Xingze V Club
How to handle the database query error with Emoji expression in Typecho- Xingze V Club
2022-06-10 23:46:00 【Xingze V Club】
When writing today, insert emoji Look unexpectedly 「Database Query Error」 Report errors ,Typecho Not supported by default Emoji expression , This is not a procedural pot , But because of the coding problem . Emoji It's a kind of Unicode be located u1F601-u1F64F The characters of the section . This obviously goes beyond the current common UTF-8 The encoding range of the character set u0000-uFFFF. stay MySQL in ,UTF-8 Only support the most 3 Bytes , and Emoji yes 4 Bytes . So the comments have Emoji The expression will report an error .
We only need two simple steps to make typecho Support emoji Expression comment , Just encode the default database utf8 It is amended as follows utf8mb4 that will do .
1. Modify the code of the comment content field Use database management tools , find typecho_contents Comment form text Field , Change the code of this field to utf8mb4_general_ci.
If it is a comment that cannot be used, find typecho_comments Comment form text Field , Change the code of this field to utf8mb4_general_ci.
All changed , I've changed everything , All have been changed and can be inserted globally emoji Expression, etc .
Run the following code :
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;
2. Modify the database configuration file Open the website root database configuration file config.inc.php take charset The value of is determined by utf8 Change it to utf8mb4 .
/** Define database parameters */
$db = new Typecho_Db('Pdo_Mysql', 'echo_');
$db->addServer(array (
'host' => 'localhost',
'user' => 'echo',
'password' => 'password',
'charset' => 'utf8mb4', // Modify this parameter
'port' => '3306',
'database' => 'echo',
), Typecho_Db::READ | Typecho_Db::WRITE);
Typecho_Db::set($db);Save after modification . nice~
边栏推荐
- [flutter problem series Chapter 6] how to achieve the scrolling effect of list messages in flutter
- PwnTheBox,Web:hello
- MySQL mvcc multi version concurrency control
- Sealem Finance - a new decentralized financial platform based on Web3
- Classic sentences in Yi Shu's works
- LeetCode+ 21 - 25
- LabVIEW执行串行回送测试
- Executor - Shutdown、ShutdownNow、awaitTermination 详解与实战
- Gather for summer Yiping: not everything is reported to Robin Lee. They compete with Xiaomi Huawei by products
- MySQL学习之子查询
猜你喜欢

LabVIEW中NI MAX中缺少串口

Unity 脚本无法显示C#源码的中文注释 或者VS创建的脚本没有C#源码的注释

Why is the kotlin language not popular now?

Yuntu says that every successful business system cannot be separated from apig

HyperLeger Fabric安装

iframe框架自适应大小/全屏显示网页框架的方法

LabVIEW编程规范

Project training 13 - Interface supplement

【Flutter 问题系列第 6 篇】如何在 Flutter 中实现列表消息的滚动效果

LeetCode+ 16 - 20
随机推荐
im即时通讯源码带教程/uniapp即时通讯源码,附安装教程
Design language testing for functional testing: what tests are included in functional testing? What is the role of each
Leetcode 501: mode dans l'arbre de recherche binaire
HyperLeger Fabric安装
C# Tryparse的用法
怎么生成自动参考文献(简单 有图)
上海网上开户是安全的吗?
What Fiddler does for testing
使用TSA包中的 beersales 数据集建立TAR模型
Data file nc6oa Txt consists of 6830 gene expression data from 33 cancer cell lines, each of which is a type of cancer cell. Please cluster the 33 cell lines according to the gene expression data (the
已知某种木材的横纹抗压力服从N(x,d2),现对十个试件作横纹抗压力试验,得数据如下:(单位:kg/cm2)
mysql 表机制
Data and information resource sharing platform (V)
Project training 11 - regular backup of database
苹果CMS采集站源码-搭建教程-附带源码-全新源码-开发文档
Is it safe to open an account in Shanghai Stock Exchange?
LabVIEW编程规范
OpenVP*整合ldap認證
Fiddler creates an autoresponder
LeetCode+ 16 - 20