当前位置:网站首页>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~
边栏推荐
- 已知某种木材的横纹抗压力服从N(x,d2),现对十个试件作横纹抗压力试验,得数据如下:(单位:kg/cm2)
- Simple impedance matching circuit and formula
- Apple CMS collection station source code - building tutorial - attached source code - new source code - development documents
- MySQL table mechanism
- Is it safe to open an account in Shanghai Securities?
- Interface test learning notes
- 30 | 怎么重设消费者组位移?
- LabVIEW调用DLL时出现异常0xc0000005代码
- Openvp * consolider l'authentification LDAP
- 字蛛(font-spider)教学——ttf/otf字体文件压缩
猜你喜欢

LabVIEW在波形图或波形图表上显示时间和日期

34. find the first and last positions of elements in the sorted array - binary search, double pointer

Solutions to the error reported by executing Oracle SQL statement [ora-00904: "createtime": invalid identifier] and [ora-00913: too many values]

Solve access denied for user 'root' @ 'localhost' (using password: yes)

LeetCode 501 :二叉搜索樹中的眾數

Before we learn about high-performance computing, let's take a look at its history

Kotlin语言现在怎么不火了?

Common settings for vs

Data and information resource sharing platform (IV)

PwnTheBox,Web:hello
随机推荐
Leetcode 501: mode dans l'arbre de recherche binaire
Yuntu says that every successful business system cannot be separated from apig
OpenVP*整合ldap认证
Prefer "big and small weeks", only write 200 lines of code every day, and the monthly salary of 8k-17k people will rise again
An adaptive size / full screen display method for iframe frames
在Oracle表中如何进行关键词搜索
Creating dynamic two-dimensional array with C language
Font spider Teaching -- ttf/otf font file compression
使用TSA包中的 beersales 数据集建立TAR模型
Developers changing the world - Yao Guang teenagers playing Tetris
数据文件 Insurance csv包含1338条观测,即目前已经登记过的保险计划受益者以及表示病人特点和历年计划入的总的医疗费用的特征。这些特征是
OpenVP*整合ldap認證
Analysis of Genesis public chain
Perfect decoding purecodec 20220601
已知某种木材的横纹抗压力服从N(x,d2),现对十个试件作横纹抗压力试验,得数据如下:(单位:kg/cm2)
Is qiniu's securities account true? Is it safe?
数据文件nc6oa.txt由33个癌细胞系得6830个基因表达数据构成,每一个细胞系都是某种类型的癌细胞的类型。请按照基因表达数据对33个细胞系进行聚类(聚类类别数划是癌细胞的类型个数,比如乳腺癌、肺
Project training 12 - parsing SQL statements for creating tables
苹果CMS采集站源码-搭建教程-附带源码-全新源码-开发文档
About string format(String format, Object... args)