错误:incorrect string value: '\xF0\x9F\x8D\x91\xE5\xB0...' for column...
1.spring配置文件:
url=jdbc\:mysql\://localhost\:3306/db_abc?useUnicode\=true&characterEncoding\=UTF-8
2.修改需要存储字符表情的字段字符集编码为utf8mb4
3.在需要插入字段的前面增加set NAMES 'utf8mb4',mybatis配置如下:
<update id="setCharacters" >
set NAMES 'utf8mb4'
</update>
@Override
public int addScore(HhtZqcjScore score) {
scoreExtMapper.setCharacters();
return scoreMapper.insert(score);
}