日常Exception第二十七回:Caused by: java.sql.SQLException: Incorrect string value: ‘xF0xACx8Cx97xE7x

Posted 善良勤劳勇敢而又聪明的老杨

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了日常Exception第二十七回:Caused by: java.sql.SQLException: Incorrect string value: ‘xF0xACx8Cx97xE7x相关的知识,希望对你有一定的参考价值。

热门系列:


1、异常信息

Caused by: java.sql.SQLException: Incorrect string value: '\\xF0\\xAC\\x8C\\x97\\xE7\\x95...' for column 'content


2、分析解决

原本的数据库表对应的字符集设置为:

 原因分析:因为我们存储的这个内容是一篇资讯,里面可能含有一些头像、表情等非常规文字的元素,导致转码后长度超过原本字符集utf8的排序规则utf8_general_ci格式的固定长度

解决方式:将对应的数据表或者数据字段,改成字符集为utf8mb4,排序规则为utf8mb4_unicode_ci即可。

以上是关于日常Exception第二十七回:Caused by: java.sql.SQLException: Incorrect string value: ‘xF0xACx8Cx97xE7x的主要内容,如果未能解决你的问题,请参考以下文章

一起Talk Android吧(第五百二十七回:监听网络状态)

一起Talk Android吧(第三百二十七回:Android中的约束布局)

一起Talk Android吧(第四百二十七回:在Android中使用MQTT通信一)

第二十七课 再论智能指针(上)

日常Exception第二十六回:RedisSystemException...RejectedExecutionException: event executor terminated

日常Exception第二十六回:RedisSystemException...RejectedExecutionException: event executor terminated