gpt4 book ai didi

php - 错误的字符串值 : '\xE8.. &n...' for column

转载 作者:行者123 更新时间:2023-11-29 22:11:40 25 4
gpt4 key购买 nike

我正在用 PHP 创建一个票证系统,它使用 imap 从 Exchange 服务器获取邮件。

当我将电子邮件中的 HTML 消息放入 MySQL 数据库时,如果消息正文中有特殊字符(如 è:),则会出现以下错误:

Incorrect string value: '\xE8. ' for column 'message' at row 1

我已经尝试过类似的东西:

utf8_encode($message);

但这只是从消息中删除了所有不应该发生的 HTML。

MySQL 表:

mysql> show create table crm.tickets;
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tickets | CREATE TABLE `tickets` (
`id` int(100) NOT NULL AUTO_INCREMENT,
`senderName` varchar(40) DEFAULT NULL,
`senderEmail` varchar(60) DEFAULT NULL,
`companyID` int(15) DEFAULT NULL,
`userID` int(15) DEFAULT NULL,
`subject` varchar(100) DEFAULT NULL,
`message` longtext,
`timestamp` int(60) DEFAULT NULL,
`toName` varchar(120) DEFAULT NULL,
`toEmail` varchar(60) DEFAULT NULL,
`ownerID` int(11) DEFAULT NULL,
`ticketStatus` int(1) DEFAULT NULL,
`ticketType` int(2) DEFAULT NULL,
`timeSpend` int(10) DEFAULT NULL,
`locked` int(1) DEFAULT NULL,
`queue` int(3) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8 |
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

有人知道吗?

最佳答案

我创建了一个自己的函数来将所有 Microsoft 字符替换为 HTML 字符。像魅力一样工作!

关于php - 错误的字符串值 : '\xE8.. &n...' for column,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31585415/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com