问题描述
我使用 spring-data-jpa
和 mysql
数据库.我的表格字符集是 utf-8.我还添加了 ?useUnicode=yes&characterEncoding=utf8
到 application.properties 文件中的 mysql url.当我将诸如ąčęėį"之类的字符传递给控制器以将其保存在mysql中时出现问题.在 mysql 我得到了???分数.但是当我使用 mysql 控制台示例 update projects_data set data="ąęąčę" where id = 1;
一切正常.
I use spring-data-jpa
and mysql
database. My tables character set is utf-8. Also I added ?useUnicode=yes&characterEncoding=utf8
to mysql url in application.properties file. Problem when I pass characters like "ąčęėį" to controller to save it in mysql. In mysql I got ??? marks. But when I use mysql console example update projects_data set data="ąęąčę" where id = 1;
every works well.
application.properties:
application.properties:
表格:
推荐答案
尝试
问题似乎是由于缺少-".
It seems issue is due to missing "-".
参考:-https://forum.hibernate.org/viewtopic.php?f=1&t=1037497&view=next
这篇关于spring 数据 jpa utf-8 编码不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!